How can 开发者_Python百科I send a signal to my process which runs inside valgrind to check its memory usage status?
Thanks!
To send a signal to valgrind
, pkill -USR1 valgrind
doesn't want to work for me.
pkill -USR1 memcheck
does the trick.
There is not a signal that tells valgrind to check its memory usage status. If you are interested in the amount of memory used by your program over time and where that memory is allocated, valgrind's massif tool can record that information, which can then be displayed using its ms_print
utility. Massif records snapshots of the program's memory usage automatically throughout the execution of the program, including a peak snapshot representing the point at which the memory usage was at its peak (within 1% using the default options).
To run your program under valgrind's massif tool:
valgrind --tool=massif yourprogram
A binary file massif.out.
pid will be created. Use ms_print to format the information in text form:
ms_print massif.out.12345
精彩评论