Hm... That's not so simple.
For dynamically allocated memory using the "new" operator or "malloc",
this can be done by:
Overriding the global operator new and adding the amount of bytes to a
global variable. You also can override global operator delete to
subtract the freed amount of bytes from that variable - that way you can
check if all allocated memory has properly been freed before terminating
your program.
If you use malloc(), write and use your own function, for example
AppMalloc() and AppFree() and add/subtract the amount of bytes to a
global variable.
There is no other way to do it in C/C++, as far as I know, and no
Windows API function that can tell you how much RAM you're using.
Hope this helps!
Stefan
Daniel Glenfield wrote:
> How can I find out how much memory my program is using?
> I'm running it under windows and was wondering if there's a Windows API
> call or some utility on the net that can latch on to my program and find
> out how much memory it is actually using.
>
> If I'm not being specific enough, tell me.
>
> Daniel
--
Stefan Kuhn
Software Development
ste...@ya...
|