Tracking dynamic memory usage in my program
- From: Edward Diener <eddielee_no_spam_here@xxxxxxxxxxxxxx>
- Date: Wed, 26 Oct 2005 19:01:07 -0400
In my program, which iterates over a loop many thousands of times, allocating and deallocating memory, I want to track dynamic memory allocation. I am doing this because Task Manager shows increasing memory each time through the loop and this does not appear to correspond to what I am doing in the loop. To track dynamic memory programatically I am using a routine that cycles through all the heaps and reports back the total allocated memory, the total committed memory, and the total uncomitted memory for all heaps. The routines uses GetProcessHeap, GetProcessHeaps and HeapWalk.
I am also checking the Task Manager in Win2k while I debug my application and look at the results. What I have seen that puzzles me is that the totals shown by Task Manager do not at all correspond to what my routines show for the memory totals I am picking up from HeapWalk. Task manager is showing a steady increase through each loop while my memory tracking routine is showing a much smaller difference in each loop, the latter corresponding much more closely to what I believe I am actually allocating and deallocating for each loop ( I am holding on to some of the data during each loop for further processing when the loop is finished, then releasing the data.
Am I doing something wrong in tracking my dynamic memory usage using heaps and HeapWalk ? Is there a better, easier way which corresponds to what Task Manager is reporting ? Why would not HeapWalk be reporting the correct amounts ?
The HeapWalk routines I am using are from http://www.codeguru.com/Cpp/W-P/win32/tutorials/article.php/c9495/ and look good to me. I have created a DLL from these routines, after changing them to do what I want, and exported the necessary functions which I am using in my program. I could be wrong but I do not think the problem is with any of this code.
.
- Follow-Ups:
- Re: Tracking dynamic memory usage in my program
- From: m
- Re: Tracking dynamic memory usage in my program
- From: Oleg Starodumov
- Re: Tracking dynamic memory usage in my program
- From: Skywing
- Re: Tracking dynamic memory usage in my program
- Prev by Date: How to get the real CPU Load
- Next by Date: Re: Tracking dynamic memory usage in my program
- Previous by thread: How to get the real CPU Load
- Next by thread: Re: Tracking dynamic memory usage in my program
- Index(es):
Relevant Pages
|
|