[SOLVED] Do I have to care about these memory leaks ?
-
Hello,
I was chasing memory leaks in my application and tried out Instruments > Leaks on OS X.
I had some memory leaks that were coming from my application and fixed these.
Now, my application doesn't leak anymore (according to Leaks).
However, there are many other leaks that don't come from my application, they seem to come from QtCore, Foundation, IOKit, etc... Do I really have to care about them ?Here's a screenshot from the leaks and the graphic showing memory usage (with my application running for ~16mn).
Btw, if I take a look in Activity Monitor, the memory my application is using keeps getting higher (like 2Mo in 15mn), is this really a problem or not ? Is Activity Monitor (or Task Manager under Windows for example) really accurate ?
Thanks for your help !
-
I'm not familiar with Leaks.
I know that sometime the tools like valgrind report memory in the libraries which are not really memory leak.But if you see a constant grow in the memory usage then you may have a memory leak.
I would analyze the suspicious places and try to turn them off and see if memory usage is stable.For example, you have some big buffer coming from a network and then you process it and do some other things that involves a memory allocation.
Try to discard the buffer immediately on receive and check the memory usage.
If it is stable then go to next step in the processing pipeline.
And continue it until you will see the memory usage increase.Another option to find a leak would be try to build and run your app for Linux and run it under valgrind.
-
Thanks for your responses.
The thing is that Activity Monitor for example seems to say that memory usage is growing slowly but at the same time, the graphic in Leaks stays flat (as you can see on the screen) and I don't know which one I can "trust".
I don't think I'm wrong if I trust Leaks rather than Activity Monitor, but I just want to make sure I don't miss any leak hidden in false positives as @andreyc says.I'll give Valgrind a try as I know it may be more accurate on Linux.
IMO if Leaks doesn't detect any leak coming from my Application name (responsible library), I should be good to go. -
Indeed, in terms of OS X libraries there's not much you can do from your code. However if you find something inside Qt's library then it's worth at least verifying on e.g. IRC #qt channel and/or the interest mailing.
-
Ok, thanks :).