Just compiled heaptrack from GIT master today and then proceeded to try to find memory leaks in my application. Since it is a child process, I started it separately and then got its PID and ran heaptrack. After finishing, I tried to open the file as instructed by heaptrack but then it complained about incompatible file version. jasem@jasem-neon:~/Projects/build/heaptrack$ heaptrack --pid 7523 /usr/bin/heaptrack: 174: [: FALSE: unexpected operator heaptrack output will be written to "/home/jasem/Projects/build/heaptrack/heaptrack.indi_eqmod_tele.7571.gz" injecting heaptrack into application via GDB, this might take some time... injection finished heaptrack stats: allocations: 0 leaked allocations: 0 temporary allocations: 0 removing heaptrack injection via GDB, this might take some time... Could not attach to process. If your uid matches the uid of the target process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try again as the root user. For more details, see /etc/sysctl.d/10-ptrace.conf warning: process 7523 is a zombie - the process has already terminated ptrace: Operation not permitted. No symbol table is loaded. Use the "file" command. The program is not being run. Heaptrack finished! Now run the following to investigate the data: heaptrack --analyze "/home/jasem/Projects/build/heaptrack/heaptrack.indi_eqmod_tele.7571.gz" jasem@jasem-neon:~/Projects/build/heaptrack$ heaptrack --analyze "/home/jasem/Projects/build/heaptrack/heaptrack.indi_eqmod_tele.7571.gz" The data file has version 2 and was written by heaptrack version 10000) This is not compatible with this build of heaptrack (version 10000), which can read file format version 1 and below jasem@jasem-neon:~/Projects/build/heaptrack$ ls -l "/home/jasem/Projects/build/heaptrack/heaptrack.indi_eqmod_tele.7571.gz" -rw-rw-r-- 1 jasem jasem 512108 Mar 29 16:34 /home/jasem/Projects/build/heaptrack/heaptrack.indi_eqmod_tele.7571.gz jasem@jasem-neon:~/Projects/build/heaptrack$ heaptrack --analyze "/home/jasem/Projects/build/heaptrack/heaptrack.indi_eqmod_tele.7571.gz" The data file has version 2 and was written by heaptrack version 10000) This is not compatible with this build of heaptrack (version 10000), which can read file format version 1 and below
Probably a bug I introduced with the addition of zstd support. What shell do you use? Can you paste the contents of `cat $(which heaptrack)` please - I want to double-check what it generated. To workaround this, install zstd development headers, it should both fix this and make heaptrack faster too :)
I think I solved this via commit 7ae3f595a0ea49abd4b8ecd8a7be2b362e0fa916 Author: Milian Wolff <milian.wolff@kdab.com> Date: Tue Apr 3 15:30:56 2018 +0200 Make heaptrack.sh file compatible with dash Don't use the bashism == to compare strings, use = instead. BUG: 392487
Created attachment 112029 [details] heaptrack cat
Nope, I just git pulled and built with zstd support and exactly the same problem on 16.04. I attached the output as you require but it's exactly same error message.
do you still see this error: /usr/bin/heaptrack: 174: [: FALSE: unexpected operator ? What does this give you in your shell: echo $SHELL if [ "TRUE" = "TRUE" ] && [ ! -z "$(which zstd)" ]; then echo "works"; fi
Oh and one more question: Can you actually attach via GDB? E.g. this part of the message makes me wonder: Could not attach to process. If your uid matches the uid of the target process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try again as the root user. For more details, see /etc/sysctl.d/10-ptrace.conf Try to run `gdb --pid ...` and see if that works for you.
I installed zstd on 16.04 machine but now getting compile errors: https://paste.kde.org/plj20ityd
Ok it appears I need to run: sudo apt-get install zstd which would install the correct libraries (I used libzstd-dev before which installed older version). At any rate, now it creates zst file. It now finally works!