This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: c++ code for display memory usage


> 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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]