Fix memory leaks in unittests to make it easier to find real memory leaks in the tested code.
Fixed tests:
- test_projectmodel
- test_areaoperation
- test_controller
- test_toolviewtoolbar
- test_viewactivation
kfunk |
KDevelop |
Fix memory leaks in unittests to make it easier to find real memory leaks in the tested code.
Fixed tests:
Many tests will fail because of LSAN (leak sanitizer), which is enabled (at least here) by default with ASAN.
Lint Skipped |
Unit Tests Skipped |
Nice!
Can be committed this way as well, but I'd research using QScopedPoiner in some places instead.
kdevplatform/project/tests/test_projectmodel.cpp | ||
---|---|---|
325 | Here and below (where you use delete ...): Try to use QScopedPointer instead of raw pointers -- that way you don't need to cleanup yourself at the end of the block? And it also cleans up memory even if we bail out at any of the QCOMPARE or QVERIFY stmts. |
kdevplatform/project/tests/test_projectmodel.cpp | ||
---|---|---|
325 | Good hint! Will do :) |
Many tests will fail because of LSAN (leak sanitizer), which is enabled (at least here) by default with ASAN.
Because I've just read this, note that this behavior can be disabled by doing:
export ASAN_OPTIONS=detect_leaks=0
... before running the tests. Sometimes it's just impossible to get all leaks fixed, because of thirdparty deps, etc..