I am debugging a memory leak issue in a java application with some native code using jna, I am using the Valgrind, I found that the java application started by valgrind run very slowly, I know that application started by valgrind may slow down for 10-50 times than native code in the official documentation, but it is really time-consuming for debugging, in my case I only need to debug the jna native code, is possible to have valgrind ignore the jvm code(libjvm.so) and focus on my native library?
I have the following configuration.
- My jna native code is compiled with the gcc options
-g and -O0
- valgrind is invoked with the parameters
valgrind --leak-check=yes --error-limit=no --suppressions=/root/valgrind_errors.txt java -jar xxx.jar
- also I tried to recompile JRE with the gcc options
-g and -O0
, it didn't speed up the execution.
Do you have some suggestions to speed up the execution?
Thanks.