Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Leaked memory object
Forum Updated to NodeBB v4.3 + New Features

Leaked memory object

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 505 Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • PerdrixP Offline
    PerdrixP Offline
    Perdrix
    wrote on last edited by
    #1

    I've recently started getting reports of a memory leak from Visual Leak Detector.

    All the other known and unavoidable leaks (from static objects) are reported like this:

    ---------- Block 532 at 0x00000000005B1580: 24 bytes ----------
     Leak Hash: 0x14515E6A, Count: 1, Total 24 bytes
     Call Stack (TID 4408):
       mfc140ud.dll!0x00007FFDCEB931E0()
       C:\Users\amonra\Documents\GitHub\DSS\ZCLass\Source\ZExcBase.cpp (124): DeepSkyStacker.exe!traceFunction_Lock() + 0xA bytes
       C:\Users\amonra\Documents\GitHub\DSS\ZCLass\Source\ZExcBase.cpp (596): DeepSkyStacker.exe!ZException::setTraceFunction() + 0x5 bytes
       C:\Users\amonra\Documents\GitHub\DSS\ZCLass\Source\ZTrace.cpp (173): DeepSkyStacker.exe!ZTrace_Init::ZTrace_Init()
       C:\Users\amonra\Documents\GitHub\DSS\ZCLass\Source\ZTrace.cpp (202): DeepSkyStacker.exe!ZTraceSetup::traceOn() + 0x21 bytes
       C:\Users\amonra\Documents\GitHub\DSS\ZCLass\Source\ZTrace.cpp (232): DeepSkyStacker.exe!ZTrace::ZTrace() + 0x5 bytes
       C:\Users\amonra\Documents\GitHub\DSS\DeepSkyStacker\DeepSkyStacker.cpp (931): DeepSkyStacker.exe!main() + 0x21 bytes
       C:\Users\qt\work\qt\qtbase\src\entrypoint\qtentrypoint_win.cpp (50): DeepSkyStacker.exe!qtEntryPoint() + 0xE bytes
       C:\Users\qt\work\qt\qtbase\src\entrypoint\qtentrypoint_win.cpp (60): DeepSkyStacker.exe!WinMain()
       D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl (107): DeepSkyStacker.exe!invoke_main()
       D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl (288): DeepSkyStacker.exe!__scrt_common_main_seh() + 0x5 bytes
       D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl (331): DeepSkyStacker.exe!__scrt_common_main()
       D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_winmain.cpp (17): DeepSkyStacker.exe!WinMainCRTStartup()
       KERNEL32.DLL!BaseThreadInitThunk() + 0x1D bytes
       ntdll.dll!RtlUserThreadStart() + 0x28 bytes
     Data:
       A8 C7 A9 40    01 00 00 00    00 00 00 00    00 00 00 00     ...@.... ........
       B0 02 00 00    00 00 00 00                                   ........ ........
    
    

    Instead all I see is:

    ---------- Block 9961 at 0x000000000A27EE40: 128 bytes ----------
      Leak Hash: 0x9C7787F5, Count: 1, Total 128 bytes
      Call Stack (TID 4408):
      Data:
        D0 1C 16 0A    00 00 00 00    D0 26 35 0A    00 00 00 00     ........ .&5.....
        20 1E 16 0A    00 00 00 00    90 22 15 0A    00 00 00 00     ........ ."......
        90 1B 35 0A    00 00 00 00    50 32 15 0A    00 00 00 00     ..5..... P2......
        70 2A 15 0A    00 00 00 00    40 21 15 0A    00 00 00 00     p*...... @!......
        50 1C 35 0A    00 00 00 00    20 22 15 0A    00 00 00 00     P.5..... ."......
        A0 2C 15 0A    00 00 00 00    F0 3B 15 0A    00 00 00 00     .,...... .;......
        B0 1C 35 0A    00 00 00 00    20 29 15 0A    00 00 00 00     ..5..... .)......
        30 33 15 0A    00 00 00 00    30 2C 15 0A    00 00 00 00     03...... 0,......
    

    which looks like an array or vector of 16 pointers. Without a call stack its a bit hard to track down.

    Does anyone recognise where that might come from?

    sierdzioS 1 Reply Last reply
    0
    • sierdzioS sierdzio

      OK, then make sure you have Qt installed with "Qt Debug Information Files" selected in Qt Maintenance Tool.

      If the problem persists then I have no idea :-(

      PerdrixP Offline
      PerdrixP Offline
      Perdrix
      wrote on last edited by Perdrix
      #5

      @sierdzio I managed to get an stack trace by changing the vld.ini file to log in Unicode and to a file, instead of in ascii to the debugger.

      That did produce the necessary stack trace! The leak turned out to be a "ui" object that belonged to a QDialog that was created with the application QMainWindow (which was a stack object in main()) as its parent.

      I don't understand why that was done rather then making the object that created it the parent (I need to discuss that with the developer).

      I don't quite understand why it wasn't cleaned up when the QMainWindow went out of scope at the end of main().

      Thanks all,
      David

      1 Reply Last reply
      1
      • PerdrixP Perdrix

        I've recently started getting reports of a memory leak from Visual Leak Detector.

        All the other known and unavoidable leaks (from static objects) are reported like this:

        ---------- Block 532 at 0x00000000005B1580: 24 bytes ----------
         Leak Hash: 0x14515E6A, Count: 1, Total 24 bytes
         Call Stack (TID 4408):
           mfc140ud.dll!0x00007FFDCEB931E0()
           C:\Users\amonra\Documents\GitHub\DSS\ZCLass\Source\ZExcBase.cpp (124): DeepSkyStacker.exe!traceFunction_Lock() + 0xA bytes
           C:\Users\amonra\Documents\GitHub\DSS\ZCLass\Source\ZExcBase.cpp (596): DeepSkyStacker.exe!ZException::setTraceFunction() + 0x5 bytes
           C:\Users\amonra\Documents\GitHub\DSS\ZCLass\Source\ZTrace.cpp (173): DeepSkyStacker.exe!ZTrace_Init::ZTrace_Init()
           C:\Users\amonra\Documents\GitHub\DSS\ZCLass\Source\ZTrace.cpp (202): DeepSkyStacker.exe!ZTraceSetup::traceOn() + 0x21 bytes
           C:\Users\amonra\Documents\GitHub\DSS\ZCLass\Source\ZTrace.cpp (232): DeepSkyStacker.exe!ZTrace::ZTrace() + 0x5 bytes
           C:\Users\amonra\Documents\GitHub\DSS\DeepSkyStacker\DeepSkyStacker.cpp (931): DeepSkyStacker.exe!main() + 0x21 bytes
           C:\Users\qt\work\qt\qtbase\src\entrypoint\qtentrypoint_win.cpp (50): DeepSkyStacker.exe!qtEntryPoint() + 0xE bytes
           C:\Users\qt\work\qt\qtbase\src\entrypoint\qtentrypoint_win.cpp (60): DeepSkyStacker.exe!WinMain()
           D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl (107): DeepSkyStacker.exe!invoke_main()
           D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl (288): DeepSkyStacker.exe!__scrt_common_main_seh() + 0x5 bytes
           D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl (331): DeepSkyStacker.exe!__scrt_common_main()
           D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_winmain.cpp (17): DeepSkyStacker.exe!WinMainCRTStartup()
           KERNEL32.DLL!BaseThreadInitThunk() + 0x1D bytes
           ntdll.dll!RtlUserThreadStart() + 0x28 bytes
         Data:
           A8 C7 A9 40    01 00 00 00    00 00 00 00    00 00 00 00     ...@.... ........
           B0 02 00 00    00 00 00 00                                   ........ ........
        
        

        Instead all I see is:

        ---------- Block 9961 at 0x000000000A27EE40: 128 bytes ----------
          Leak Hash: 0x9C7787F5, Count: 1, Total 128 bytes
          Call Stack (TID 4408):
          Data:
            D0 1C 16 0A    00 00 00 00    D0 26 35 0A    00 00 00 00     ........ .&5.....
            20 1E 16 0A    00 00 00 00    90 22 15 0A    00 00 00 00     ........ ."......
            90 1B 35 0A    00 00 00 00    50 32 15 0A    00 00 00 00     ..5..... P2......
            70 2A 15 0A    00 00 00 00    40 21 15 0A    00 00 00 00     p*...... @!......
            50 1C 35 0A    00 00 00 00    20 22 15 0A    00 00 00 00     P.5..... ."......
            A0 2C 15 0A    00 00 00 00    F0 3B 15 0A    00 00 00 00     .,...... .;......
            B0 1C 35 0A    00 00 00 00    20 29 15 0A    00 00 00 00     ..5..... .)......
            30 33 15 0A    00 00 00 00    30 2C 15 0A    00 00 00 00     03...... 0,......
        

        which looks like an array or vector of 16 pointers. Without a call stack its a bit hard to track down.

        Does anyone recognise where that might come from?

        sierdzioS Offline
        sierdzioS Offline
        sierdzio
        Moderators
        wrote on last edited by
        #2

        @Perdrix This is from a debug build right?

        Sorry I'm familiar with outputs from asan on Linux but not on Windows. Just wanted to say that I often get leaks detected in: fontconfig and in nVidia graphics drivers. Fontconfig probably won't apply here but maybe nVidia has the same leaks on Windows? In such case there is nothing you can do about it (but also: it's not your bug :-) ).

        (Z(:^

        PerdrixP 1 Reply Last reply
        0
        • sierdzioS sierdzio

          @Perdrix This is from a debug build right?

          Sorry I'm familiar with outputs from asan on Linux but not on Windows. Just wanted to say that I often get leaks detected in: fontconfig and in nVidia graphics drivers. Fontconfig probably won't apply here but maybe nVidia has the same leaks on Windows? In such case there is nothing you can do about it (but also: it's not your bug :-) ).

          PerdrixP Offline
          PerdrixP Offline
          Perdrix
          wrote on last edited by
          #3

          @sierdzio Yes it's a debug build

          sierdzioS 1 Reply Last reply
          0
          • PerdrixP Perdrix

            @sierdzio Yes it's a debug build

            sierdzioS Offline
            sierdzioS Offline
            sierdzio
            Moderators
            wrote on last edited by
            #4

            OK, then make sure you have Qt installed with "Qt Debug Information Files" selected in Qt Maintenance Tool.

            If the problem persists then I have no idea :-(

            (Z(:^

            PerdrixP 1 Reply Last reply
            0
            • sierdzioS sierdzio

              OK, then make sure you have Qt installed with "Qt Debug Information Files" selected in Qt Maintenance Tool.

              If the problem persists then I have no idea :-(

              PerdrixP Offline
              PerdrixP Offline
              Perdrix
              wrote on last edited by Perdrix
              #5

              @sierdzio I managed to get an stack trace by changing the vld.ini file to log in Unicode and to a file, instead of in ascii to the debugger.

              That did produce the necessary stack trace! The leak turned out to be a "ui" object that belonged to a QDialog that was created with the application QMainWindow (which was a stack object in main()) as its parent.

              I don't understand why that was done rather then making the object that created it the parent (I need to discuss that with the developer).

              I don't quite understand why it wasn't cleaned up when the QMainWindow went out of scope at the end of main().

              Thanks all,
              David

              1 Reply Last reply
              1
              • sierdzioS sierdzio has marked this topic as solved on

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved