Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-6973

Mac OSX Carbon memory leak when using QWidget::setWindowIcon()

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 4.6.1
    • 4.5.3, 4.6.0
    • GUI: Window management
    • None
    • Mac OSX Leopard
    • macOS
    • b2e5e2158529f49390ec597cda823c72336b23ff

    Description

      The Mac OSX Carbon implementation leaks memory if a QMainWindow is decorated via setWindowIcon(), the icon is not freed if the window is destroyed.
      compile/run the attached application and watch the memory usage with the Activity Monitor: The memory quickly grows in 200k steps.
      The reason is that the mac specific 'windowIcon' member is not freed in the destructor, it should be probably done in
      void QWidgetPrivate::deleteTLSysExtra() via 'ReleaseIconRef'.
      One can measure this pretty accurate with the help of the Mac OSX malloc env helpers
      % MallocStackLogging=1 ./qt4iconbug.app/Contents/MacOS/qt4iconbug
      % heap qt4iconbug>1.log;sleep 5;heap qt4iconbug>2.log
      with 'malloc_history" one can also immediately see that the biggest memory consumer is the icon.
      As a workaround if I use setWindowIcon(emptyIcon) before deleting the toplevel widget, the leaking is greatly reduced
      (but still there is a memory increase due to smaller leaks in the svg routines)
      Kind Regards, Leo

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            pullatti Prasanth Ullattil
            ls@4js.com Leo Schubert
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes