Reputation: 11
I have got a memory leak which I'm trying to track with massif. The problem is that the leak happens always like couple of hours after an app is started. Now application that runs on massif is about 20 times slower than normal, thus for the leak to happen I must wait like 100 hours or more. I was even trying to wait this time, but it happened that no leak was there. I suspect that the leaks may somehow occur only when my project is running on full speed? Since it is not possible to attach valgrind to running process, is there maybe the way to postpone valgrind so it will collect the data after some time, or even better on the request? This way I could wait some time when the program is running fine (with hopefully normal speed), and start logging at the moment leaks are occurring.
Any help is appreciated.
Upvotes: 0
Views: 184
Reputation: 11
For those who also stucked with similar issue as me. I found other solution. Instead using of valgring I did used libleak tool which does pretty much the same job as massif, but it's way less resource consuming. For details, please refer to: https://github.com/WuBingzheng/libleak
Upvotes: 0
Reputation: 6906
For memory leaks, memcheck
is the best tool that is part of Valgrind. It is possible to trigger leak checks with memcheck. You can either modify your executable to add Valgrind client requests, or else run under the gdb/vgdb and use the monitor command.
The only thing that I'm aware of for Massif is a recent patch to allow client requests. You would have to download the Valgrind source, apply this patch and build Valgrind. I have no experience with it.
You might also consider heapcheck
and if modifying your build is possible, leak sanitizer.
Upvotes: 0