memory leak
-
I built a desktop application but I find that the memory continuously increases while I am running it .
I tried tracking it with Visual Leak Detector and it seems to find leaks in the QT modules .
Is this a known issue ? I am using QT 5.1 community .Is it worth trying QT 5.5. ?
I am trying to install QT 5.5 but the add-in 1.2.4. for Visual Studio isn't installing properly .What about the full licensed edition of QT ? ... Is it likely to have better result ?
-
Are you sure it's not your code that's leaking?
Just cause the detector points to Qt's guts doesn't mean you're not responsible for it.
Can you provide a small reproducible example code? -
Not really possible to show code . It is a whole application , many files and lines .
Not a known issue ? I am kind of convinced it is QT . I removed all my animations and graphics
and it is still leaking and the leak detector doesn't show anything in my code . -
It is a whole application , many files and lines
Makes me think even more that it's your code that's leaking. If it's Qt that's leaking you should be able to reproduce it in a minimal example app. Since your leak detector points you to the offending place it might be enough to create a main function with an instance of that Qt class.
Not a known issue ?
I haven't really used 5.1 in a long time now (over 2 years?) so I can't recall any problem in particular but if there was some the only solution anyway would be to update. There's no way anyone would consider patching such an old release.
I am kind of convinced it is Qt
Why? Without some concrete evidence it's a case of belief not facts.
-
Looks like I removed the offending code but the memory still increases .
What are the possible causes of memory continuously increasing in an application ? If it is not a memory leak ?
Looks like this will be a tough one to fix . -
There are tools which may help you to find leaks.
Google "memory leak detection C++".But even if code have no leaks every time you allocate something it might be allocated in a new chunk of memory.
So memory application usage may be up to 2 times needed. It does suppose to stop at one point though. -
Yes , I am already using Visual Leak Detector .
But your point that the memory increase may stop eventually is interesting .
I will see if I can make the program run by itself over a day and see if there is a limit . -
There is of course infinite number of bugs that can cause memory leaks, but some of the common ones in Qt application is allocating objects on the heap and not giving them parents or removing manually (Common bug with showing dialogs or tool windows).
Another popular one is adding actions to menus and not deleting them (the menu does not take ownership of the action).
A popular network related issue is not deleting the response object after a query.But these are just handpicked examples. Without narrowing the problem down to sensible code snippet it's impossible to tell what's happening.
I'd say start from scratch. Comment out everything in our main and add stuff one by one monitoring when this happens.Also, if not the code itself, could you at least provide us with the VLD output?