|
|
Vincent Le Chevalier <gal### [at] libertyallsurfspamfr> wrote:
> What's really strange is that valgrind, which tracks everything having
> to do with memory, does not provide the peak usage in the output. It's
> on the graph written by massif, one of the tools, but there is no
> numerical value.
valgrind only counts how much memory is *explicitly* allocated by
the program (eg. with malloc calls). It doesn't show the *real* amount
of memory used by the object. The real amount may be larger for several
reasons, such as each 'malloc()' or 'new' call causing extra 16 bytes to
be allocated, the memory page size in linux being 4 kilobytes, etc etc.
Also memory fragmentation may well cause the program to allocate
considerably more memory than it's really using, and valgrind won't
show you that because it only counts explit mallocs and frees. (The real
amount of memory used can only be examined with system calls because
it's the OS which is book-keeping the real amount of memory allocated for
each process.)
Examining brk calls with strace gets much closer to the truth, but
it may not be a completely sure way of telling the real amount of memory
the process is using (as some memory may be allocate with mmap2).
--
- Warp
Post a reply to this message
|
|