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

Memory leak in QNSWindowHelper initWithNSWindow:

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P3: Somewhat important P3: Somewhat important
    • 5.12.1
    • 5.9.3
    • QPA
    • macOS 10.12.6
    • macOS
    • 12045801f742dd956f17d1a6c72b21f8f245a671 (qt/qtbase/5.12)

      There's a memory leak in [QNSWindowHelper initWithNSWindow:] method in qtbase/src/plugins/platforms/cocoa/qcocoawindow.mm file (line 145 in 5.9.4 branch):

      _window.delegate = [[QNSWindowDelegate alloc] initWithQCocoaWindow:_platformWindow];

      Looks like a missing autorelease.

       

      Attached example can be used to see this. 

      It creates 5000 dialogs one by one, show, close and release them. After that it waits giving a chance to release resources asynchronously just in case. It's visible that memory grows during dialogs creation/releasing and never restores back when all dialogs are released. 'leaks' utility report showing QNSWindowDelegate leaks is also attached.

        1. leaks_report.txt
          342 kB
        2. qtbug65693..zip
          2 kB
        For Gerrit Dashboard: QTBUG-65693
        # Subject Branch Project Status CR V

            vestbo Tor Arne Vestbø
            pavol.markovic Pavol Markovic
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes