|
From: David G. <in...@we...> - 2009-07-11 15:21:28
|
Hey folks, is there any possibility to detect maximum heap memory usage of an application? valgrind offers me the number of allocated bytes, but that's uninteresting for me because it's the sum of bytes whose is ever allocated through malloc. I've tried --tool=massif but I didn't understand to interpret it correctly. Can anybody help me? Greetz, David |
|
From: tom f. <tf...@al...> - 2009-07-11 17:06:20
|
David Gregorczyk <in...@we...> writes: > is there any possibility to detect maximum heap memory usage of an > application? [snip] > I've tried --tool=massif but I didn't understand to interpret it > correctly. > > Can anybody help me? http://valgrind.org/docs/manual/ms-manual.html#ms-manual.theoutputpreamble -tom |
|
From: tom f. <tf...@al...> - 2009-07-11 18:29:20
|
Please keep discussions on-list.
David Gregorczyk <in...@we...> writes:
> but what can I do to summarize massif's multiple outputs for
> each child process? I've tried to watch out memory usage for
> Xerces-C++ and get more than 10 output files. To get complete memory
> consumption, I have to intrepret every file with ms_print and search
> for the peak consumption. For one measurement that seems ok, but I
> have to check out the program's behaviour for 16 input files.
Sounds like a job for your friendly neighborhood awk.
BEGIN {
max_percent=0
max_bytes=0
}
/heap allocation functions/ {
percent=$1
bytes=$2
if(percent > max_percent || bytes > max_bytes) {
max_percent=percent
max_bytes=bytes
max_file=FILENAME
}
}
END {
printf "Largest heap usage was %d (%d%%) from output %s\n", \
max_bytes, max_percent, max_file
}
Untested, I've actually never even used massif, just basing that on the
doc's output. You get the idea though.
Massif might have an xml output mode too (I don't know). I would
expect programmatically parsing the default output will break in some
subsequent version, but presumably an xml output would be designed for
consistency across revisions.
Cheers,
-tom
|