#7 Object Statistics

open
nobody
None
5
2007-07-19
2007-07-19
Myles Penlington
No

I like to be able to get counts of how many objects of any class that has been created, when running the option has been enabled.

Then get a report once the program terminates, that lists in # created order, and the class name.

e.g.

TLabel 2033
TPanel 124
TForm 6
TDatamodule 3

This used to be available as one of the options in Memcheck, which was very useful in tracking down performance issues and potential runtime leaks or excessive memory use.

Discussion

  • André Mussche
    André Mussche
    2009-01-22

    I would like to use this functionality in my own code, so I can call it multiple times during runtime.
    For example: 1: start program, 2: make a memory usage summary (classes, count, total size), 3: execute come code, 4: make another summary, 5: compare with (for example) winmerge to see which new objects are created in that code part

    I made a small and ugly modification in Fastmm.pas to be able to do this to fix a huge memory leak in a program.

    Btw: such a summary is much smaller and faster than a full dump with stack traces etc.
    Btw: also make it possible to save to CSV, so you can sort on count or total size, etc.