Click to See Complete Forum and Search --> : Heap statistics


DonAngel
April 16th, 1999, 07:39 AM
Has somebody tried to get specified statistics about heap allcations/frees on per-thread/per function level?
Is somewhere a class, which could give me information about heap allocations/deletions (the best would be this class to have an activate/deactivate function, because I need only partial statistics - in one part of the code)...

Dave Lorde
April 16th, 1999, 09:20 AM
MFC's DEBUG_NEW enables this kind of stuff. When you compile a debug version of your program, DEBUG_NEW keeps track of the file name and line number for each object that it allocates. Then, when you call DumpAllObjectsSince, as described in the topic 'Dumping All Objects', each object allocated with DEBUG_NEW will be shown with the file and line number where it was allocated, thus allowing you to pinpoint the sources of memory leaks, etc.

Check out 'Tracking Memory Allocations' in the online docs.

Dave

Gomez Addams
April 16th, 1999, 11:53 AM
Also have a look at _heapwalk. It requires a bit of effort on your part to use however.