#7 Object Statistics

Myles Penlington

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.


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.


  • André Mussche
    André Mussche

    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.