How to detect memory leakage ?
-
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 ? -
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.@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.
-
@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.
@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.
-
@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.
@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)
-
I took information from https://doc.qt.io/qt-6/qtqml-javascript-memory.html
-
@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)
@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.