Memory debugging in windows
Hello,
I am developing a windows application with QT using its Eclipse integration.
I am currently using Wu Yongwei's memory leak detector (http://wyw.dcweb.cn/leakage.htm), as recommended at MinGW site, but it seems to have problems with QT.
Some memory leaks are detected in a simple application with only a MainWindow with a pair of simple widgets. All these leaks appear at ui_*.h files, generated by QT. I have edited these files and I can see that there is a "new" for each widget attatched to the MainWindow and that there is no "delete" for it.
I'd like to know if:
- QT is freeing that memory itself (and my memory leak detector has problems for detecting it).
- QT leaves the memory allocated because windows will free it when the application is finished (so any memory leak detector will tell me about this memory).
If it's the first case, can you recommend a memory leak detector for windows that can be used with MinGW that get rid of that memory leaks?
If it's the second, do you know any way to "filter" the leaks detected in order to hide the ones produced by QT? It's quite annoying seeing lots of them ;)
Thanks in advance,
Re: Memory debugging in windows
If you create a widget on the heap (using "new") as child of a different widget (using the "parent" argument of the constructor) Qt will delete the child widget for you if you delete the parent widget.
This principle works with complete "widget trees". There is exactly one root widget in a tree. Deleting this widget will result of deletion of all widgets in that tree.
Most likely your leak detection tool doen't know this and sees many "new newWidget( parentWidget );" statements without corresponding delete statements.
Re: Memory debugging in windows
Ok, thanks...
So, now, can someone recommend a memory leak detector for windows that can be used with MinGW that doesn't get confused with QT widget's deletion?
Re: Memory debugging in windows