[Development] Qt's Leak-on-exit policy

Alex Montgomery apmontgomery at gmail.com
Wed Dec 18 00:42:36 CET 2013


Hi everybody,

We had a small discussion on the #qt-labs IRC channel about memory leaks
earlier, and I'd like to get a feel from the community in general.

In QtQuick, QSGRenderLoop::instance() can create a QSGWindowsRenderLoop
using new that it never destroys. The memory is always pointed to by a
static member pointer, so it's never "lost" exactly, but the memory is
never freed by Qt (but hopefully will be by any decent OS). Is this a bug?
Should Qt libs bother freeing memory on exit, or is this an unnecessary
expense?

This issue is important to my company, because we use our own memory
manager that complains loudly when memory is not freed, and we now have a
ton of false positives from this series of allocations. In my experience,
Qt has very few leaks-on-exit, so it seems like the de facto standard is to
clean-up memory and not leave it to the OS, but maybe that's been a happy
accident so far.

Should Qt clean-up dynamically allocated reachable pointers, or is this useless
/ pointless work?

Best regards,
Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20131217/e72e0ae7/attachment.html>


More information about the Development mailing list