Sign in to follow this  
NicoG

Memory Leaks in QT?

Recommended Posts

Hi there. I have tried QT a few days ago and I activated _CRT_SET_DBG_FLAG(flag) in Visual Studio 2008 Express. When exiting the Application, VS reported a very large bunch of Memory Leaks. Are they real? I can't imagine that tbh, but it confuses me. I think that the flag collides with some stuff in the librarym but as I said, it confuses me. :) Thanks for replies. Best Regards.

Share this post


Link to post
Share on other sites
AFAICT the leaks are harmless, because (in my app) memory usage doesn't grow over time. I guess Qt doesn't care about releasing memory in some case because it will get freed at application exit anyway. It is possible that leak detectors report operator new usages which aren't matched up with operator delete, because in some cases (low level data structures) destruction is costly and/or not neccessary, and has been omitted.

Share this post


Link to post
Share on other sites
Qt3, at least, uses memory pooling for a number of objects like fonts. It's not a memory leak per se, since although the memory is allocated on startup and never freed, the memory use does not grow over time.

It does generate a lot of noise in a leak detection tool.

I'm less familar with Qt4. It may behave differently.

Share this post


Link to post
Share on other sites
Why are you defining that macro? Qt manages its reference counting with QObject. When you attach to that you shouldn't worry about handling delete etc. But you have to derive from QObject to get that.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this