I just pulled my hair out trying to make Tools cough in my intentionally designed memory leaks. My test case is as follows:
class Leaker { public: char *_array; Leaker() { _array=new char[1000]; } ~Leaker() { } }; void *leaker() { void *p=malloc(1000); int *pa=new int[2000]; { Leaker l; Leaker *pl=new Leaker(); } return p; } int main (int argc, char **argv) { for (int i=0; i<1000; ++i) { leaker(); } sleep(2);
Mostly, the tools never found obvious leaks. I went crazy, but then I found “sec Between Auto Detections” in the “Leakage Configuration” panel of the “Leaks” panel. I scored it as low as it would have been, which was 1 second, and put the dream (2) in my code and voila; leaks found!
As far as I know, a leak is a leak, regardless of whether it occurs 30 minutes in the application or 30 milliseconds. In my case, I canceled the test case to the above code, but my real application is a command line application without an interface or something else, and it runs very quickly; Of course, the default sampling interval is less than 10 seconds.
Okay, so I can live a couple of seconds after exiting my application in toolkit mode, but what I REALLY want is to just have a snapshot memory of the tools on exit, and then do whatever it takes over time time when the application is running.
So ... the question is: is there a way to take tool snapshot memory when the application exits, regardless of the sampling interval?
Greetings
Shane
source share