c++ code for display memory usage
Michael Wieher
michael.wieher@gmail.com
Wed Feb 25 15:43:00 GMT 2009
> Alternatively, you could intercept malloc (and calloc, realloc, and perhaps
> valloc) and sum up all memory allocations on the heap, then call the real
> Standard C malloc. That would give you "all memory ever allocated"
> footprint.
>
> If you also wanted to keep track of high water memory allocation, you'd have
> to intercept free and figure out how the heap stores the memory block's size
> (or record the block size yourself in your intercepted the malloc).
Alternately there are programs like VALGRIND or dmalloc which can help.
I suggest wikipedia "valgrind" and wikipedia "dmalloc"
Read those articles, they'll give you a better idea of what you're
asking, and what to ask for.
More information about the Gcc-help
mailing list