Today I learned…

May 2nd 2010 09:06 pm

… that the ~QX11PixmapData(): QPixmap objects must be destroyed before the QApplication object, otherwise the native pixmap object will be leaked. warning most KDE applications display when exiting is actually false.

The X server will cleanup any opened resources, including pixmaps, automatically when the client exits. This is much like how the kernel automatically closes files and memory allocations when an application exits.

(The QPixmaps in question are the ones cached by KIconLoader as best as I can tell. They are cleaned up, just not before QApplication’s destructor runs.)

Posted by mpyne under Computing Troubles & KDE | 5 Comments »

5 Responses to “Today I learned…”

  1. Björn Ruberg Identicon Icon Björn Ruberg responded on 03 May 2010 at 01:57 #

    Might this be the reason why my X-servers uses more and more RAM over time until I restart it?

  2. Will Stephenson Identicon Icon Will Stephenson responded on 03 May 2010 at 03:23 #

    @Björn: No, read the article again. It says that the leak warning from QApps that are terminating is incorrect. Your X server may be using more and more RAM over time because apps that are still running are allocating more and more pixmaps, but it is good at cleaning up after apps that no longer run.

  3. Christoph Identicon Icon Christoph responded on 03 May 2010 at 06:06 #

    Is this also true for shared pixmaps?

  4. TGM Identicon Icon TGM responded on 03 May 2010 at 06:40 #

    Does this work cross platform?

  5. Richard Moore Identicon Icon Richard Moore responded on 03 May 2010 at 10:34 #

    @TGM what do you mean? This is X11 specific as evidenced by the class QX11PixmapData, it should work on any X server though if that’s what you’re asking.

Trackback URI | Comments RSS

Leave a Reply