WuBingzheng / memleax
- пятница, 10 июня 2016 г. в 03:12:17
C
detects memory leak of running process
memleax
detects memory leak of a running process.
memleax
attachs a running process, hooks memory allocate/free APIs,
records all memory blocks, and reports the blocks which live longer
than 5 seconds (you can change this time by -e option) in real time.
So it is very convenient to use.
There is no need to recompile the program or restart the target process.
You run memleax
to monitor the target process, wait the real-time memory
leak report, and kill it (e.g. by Ctrl-C) to stop monitoring.
NOTE: Since memleax
does not run along with the whole life of target
process, it assumes the long-live memory blocks are memory leak.
Downside is you have to set the expire threshold by -e option according
to your scenarios; while the upside is the memory allocation for process
initialization is skipped, besides of the convenience.
To detect a running process:
$ memleax [options] <target-pid>
then memleax
monitors the target process, and will report memory leak in real time.
It stops monitoring and quits on:
memleax
(by SIGKILL or Ctrl-C), orAfter quiting, it also gives statistics for the CallStacks with memory leak.