Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to detect memory leakage ?
Forum Updated to NodeBB v4.3 + New Features

How to detect memory leakage ?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
7 Posts 3 Posters 732 Views
  • 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.
  • S Offline
    S Offline
    squareroot80
    wrote on last edited by
    #1

    I have found some information about logging of memory leakage detection:
    Q_LOGGING_CATEGORY(lcGcStats, "qt.qml.gc.statistics")
    Q_DECLARE_LOGGING_CATEGORY(lcGcStats)
    Q_LOGGING_CATEGORY(lcGcAllocatorStats, "qt.qml.gc.allocatorStats")
    Q_DECLARE_LOGGING_CATEGORY(lcGcAllocatorStats)
    How to use this logging category in order to detect memory leakage ?

    1 Reply Last reply
    0
    • JonBJ Online
      JonBJ Online
      JonB
      wrote on last edited by
      #2

      Those look more like some kind of code to show memory usage.
      For "memory leakage" I would expect you to use a tool like valgrind.

      S 1 Reply Last reply
      3
      • JonBJ JonB

        Those look more like some kind of code to show memory usage.
        For "memory leakage" I would expect you to use a tool like valgrind.

        S Offline
        S Offline
        squareroot80
        wrote on last edited by squareroot80
        #3

        @JonB said in How to detect memory leakage ?:

        Those look more like some kind of code to show memory usage.
        For "memory leakage" I would expect you to use a tool like valgrind.

        Valgrind gives false positive detection even on empty qml application. Valgrind is not comfortable to detect rare leakage. I prefer logging instead of profiling.

        JoeCFDJ 1 Reply Last reply
        0
        • S squareroot80

          @JonB said in How to detect memory leakage ?:

          Those look more like some kind of code to show memory usage.
          For "memory leakage" I would expect you to use a tool like valgrind.

          Valgrind gives false positive detection even on empty qml application. Valgrind is not comfortable to detect rare leakage. I prefer logging instead of profiling.

          JoeCFDJ Offline
          JoeCFDJ Offline
          JoeCFD
          wrote on last edited by JoeCFD
          #4

          @squareroot80 Asan is another one for memory leak detection. But valgrind is good enough. Not all output from valgrind is correct. But if there is a leak, valgrind is able to show it. I do not think logging is made for this.

          S 1 Reply Last reply
          0
          • JoeCFDJ JoeCFD

            @squareroot80 Asan is another one for memory leak detection. But valgrind is good enough. Not all output from valgrind is correct. But if there is a leak, valgrind is able to show it. I do not think logging is made for this.

            S Offline
            S Offline
            squareroot80
            wrote on last edited by squareroot80
            #5

            @JoeCFD said in How to detect memory leakage ?:

            @squareroot80 Asan is another one for memory leak detection. But valgrind is good enough. Not all output from valgrind is correct. But if there is a leak, valgrind is able to show it. I do not think logging is made for this.

            What's purpose of this elements in Qt ?

            Q_LOGGING_CATEGORY(lcGcStats, "qt.qml.gc.statistics")
            Q_DECLARE_LOGGING_CATEGORY(lcGcStats)
            Q_LOGGING_CATEGORY(lcGcAllocatorStats, "qt.qml.gc.allocatorStats")
            Q_DECLARE_LOGGING_CATEGORY(lcGcAllocatorStats)
            
            JoeCFDJ 1 Reply Last reply
            1
            • S Offline
              S Offline
              squareroot80
              wrote on last edited by
              #6

              I took information from https://doc.qt.io/qt-6/qtqml-javascript-memory.html

              1 Reply Last reply
              0
              • S squareroot80

                @JoeCFD said in How to detect memory leakage ?:

                @squareroot80 Asan is another one for memory leak detection. But valgrind is good enough. Not all output from valgrind is correct. But if there is a leak, valgrind is able to show it. I do not think logging is made for this.

                What's purpose of this elements in Qt ?

                Q_LOGGING_CATEGORY(lcGcStats, "qt.qml.gc.statistics")
                Q_DECLARE_LOGGING_CATEGORY(lcGcStats)
                Q_LOGGING_CATEGORY(lcGcAllocatorStats, "qt.qml.gc.allocatorStats")
                Q_DECLARE_LOGGING_CATEGORY(lcGcAllocatorStats)
                
                JoeCFDJ Offline
                JoeCFDJ Offline
                JoeCFD
                wrote on last edited by JoeCFD
                #7

                @squareroot80 said in How to detect memory leakage ?:

                qt.qml.gc.statistics

                From the link:
                Note: There are memory profiling tools that do not understand this mechanism and over-report JavaScript memory usage.

                You could be right. This is QML specific and something new for me. Thanks for your post.

                1 Reply Last reply
                0

                • Login

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