Qt Creator Valgrind Memcheck tooooo slow
-
Hi,
When I am using Valgrind Memcheck in Qt Creator the application starts but is tooooo slow.
Is there a possibility to speed it up?
This is the command that it used in Qt Creator to start Valgrind Memcheck.
How can I adjust this command? Maybe it is possible to optimize the execution here?valgrind --child-silent-after-fork=yes --xml-socket=192.168.0.142:46155 --log-socket=192.168.0.142:46075 --xml=yes --smc-check=stack --tool=memcheck --gen-suppressions=all --track-origins=yes --leak-check=summary --num-callers=30 --vgdb=yes --vgdb-error=0 /usr/lib/path/app
Kind regards
-
Hi,
When I am using Valgrind Memcheck in Qt Creator the application starts but is tooooo slow.
Is there a possibility to speed it up?
This is the command that it used in Qt Creator to start Valgrind Memcheck.
How can I adjust this command? Maybe it is possible to optimize the execution here?valgrind --child-silent-after-fork=yes --xml-socket=192.168.0.142:46155 --log-socket=192.168.0.142:46075 --xml=yes --smc-check=stack --tool=memcheck --gen-suppressions=all --track-origins=yes --leak-check=summary --num-callers=30 --vgdb=yes --vgdb-error=0 /usr/lib/path/app
Kind regards
@MHermann said in Qt Creator Valgrind Memcheck tooooo slow:
Is there a possibility to speed it up?
Yes, stop using valgrind and use address sanitizer instead. It's built into all modern GCC and clang versions. It's faster and often more accurate than valgrind.
If you're using qmake, you can add this to your .pro:
asan { message("Address sanitizer: enabled. Use only in debug builds") CONFIG *= sanitizer sanitize_address QMAKE_CXXFLAGS *= "-fsanitize=address -fno-omit-frame-pointer" QMAKE_CFLAGS *= "-fsanitize=address -fno-omit-frame-pointer" QMAKE_LFLAGS *= "-fsanitize=address" }
Then call qmake with
CONFIG+=asan
and rebuild your project. When you run it, asan will work and start printing all memory issues to the console. -
@MHermann said in Qt Creator Valgrind Memcheck tooooo slow:
Is there a possibility to speed it up?
Yes, stop using valgrind and use address sanitizer instead. It's built into all modern GCC and clang versions. It's faster and often more accurate than valgrind.
If you're using qmake, you can add this to your .pro:
asan { message("Address sanitizer: enabled. Use only in debug builds") CONFIG *= sanitizer sanitize_address QMAKE_CXXFLAGS *= "-fsanitize=address -fno-omit-frame-pointer" QMAKE_CFLAGS *= "-fsanitize=address -fno-omit-frame-pointer" QMAKE_LFLAGS *= "-fsanitize=address" }
Then call qmake with
CONFIG+=asan
and rebuild your project. When you run it, asan will work and start printing all memory issues to the console. -
Hm, never seen that message :-(
Have you used this in all of your .pro files, including the one producing the executable?
-
Hm, never seen that message :-(
Have you used this in all of your .pro files, including the one producing the executable?
-
valgrind --help to list selections and run it from command line. It is not that slow as inside qt-creator.
for example:
valgrind --leak-check=full --leak-resolution=high your appalso build your app or run your app with asan from command line. It may be faster. I use qt creator only for editing and debugging.
-
@MHermann said in Qt Creator Valgrind Memcheck tooooo slow:
Is there a possibility to speed it up?
Yes, stop using valgrind and use address sanitizer instead. It's built into all modern GCC and clang versions. It's faster and often more accurate than valgrind.
If you're using qmake, you can add this to your .pro:
asan { message("Address sanitizer: enabled. Use only in debug builds") CONFIG *= sanitizer sanitize_address QMAKE_CXXFLAGS *= "-fsanitize=address -fno-omit-frame-pointer" QMAKE_CFLAGS *= "-fsanitize=address -fno-omit-frame-pointer" QMAKE_LFLAGS *= "-fsanitize=address" }
Then call qmake with
CONFIG+=asan
and rebuild your project. When you run it, asan will work and start printing all memory issues to the console.@sierdzio I think that you meant "sometimes more accurate".
ASan will detect stack variable bounds errors.
It won't detect any issues in libc or libstdc++/libc++ unless you have a sanitizer build of those libraries.
ASan is also only byte accurate. That means that if you use bitfields and you have a byte with a mixture of uninitialized and initialized bits then it will likely not detect an error.
-
Hi,
When I am using Valgrind Memcheck in Qt Creator the application starts but is tooooo slow.
Is there a possibility to speed it up?
This is the command that it used in Qt Creator to start Valgrind Memcheck.
How can I adjust this command? Maybe it is possible to optimize the execution here?valgrind --child-silent-after-fork=yes --xml-socket=192.168.0.142:46155 --log-socket=192.168.0.142:46075 --xml=yes --smc-check=stack --tool=memcheck --gen-suppressions=all --track-origins=yes --leak-check=summary --num-callers=30 --vgdb=yes --vgdb-error=0 /usr/lib/path/app
Kind regards
@MHermann Some comments about the options used.
--tool=memcheck this is the default so you don't need it (harmless though).
--track-origins=yes this is likely to cause a substantial slowdown. I recommend not turning this on until after an error has been detected.
--num-callers=30 do you really need to record callstacks to a depth of 30?
-
@sierdzio:
I only have one .pro file.I had to add this environment variable: LD_PRELOAD = /usr/lib/arm-linux-gnueabihf/libasan.so.5
Now it is working. -
@MHermann Some comments about the options used.
--tool=memcheck this is the default so you don't need it (harmless though).
--track-origins=yes this is likely to cause a substantial slowdown. I recommend not turning this on until after an error has been detected.
--num-callers=30 do you really need to record callstacks to a depth of 30?