Valgrind Massif tool force snapshot

2.8k Views Asked by At

I am looking to put something in my code so that I can force a Massif snapshot at certain points of its execution, for example in a server to dump out a massif snapshot to file between requests to see if I am holding onto a lot of memory between requests. I have not been able to spot a way whether it be macro or library call to force it to dump out a snapshot at that point is there anyway to do this?

Thanks

1

There are 1 best solutions below

0
On

There 3 ways to ask massif to output a snapshot. They all go via a monitor request as documented in http://www.valgrind.org/docs/manual/ms-manual.html#ms-manual.monitor-commands

These monitor requests can be passed to massif 3 different ways:

  1. interactively, from a shell, using vgdb. E.g. vgdb snapshot

  2. interactively, from gdb, using gdb+vgdb. E.g. (gdb) monitor snapshot

  3. from your program, by using the valgrind client request VALGRIND_MONITOR_COMMAND("snapshot") or VALGRIND_MONITOR_COMMAND("detailed_snapshot")