Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

240
Views
Valgrind does not show correct heap usage when run an app through shell script

I am using valgrind to check heap allocation of archive/compression tool p7zip (7zip on Windows) on Linux. I downloaded the code from here (https://sourceforge.net/projects/p7zip/files/p7zip/) and build it (make all_test) and then installed it (./install.sh).

After installation, a shell script named '7Za' is created at /usr/local/bin and its content reads as:

#! /bin/sh
"/usr/local/lib/p7zip/7za" "$@"

Also, on the specified path /usr/local/lib/p7zip/7za the executable of 7za is placed.

Now, if I run valgrind to test the memory usage of 7za (which basically runs the shell script) using this command then I get just 2KB of heap usage.

valgrind 7za x file.7z

Whereas, if I directly use the 7za binary then I get high memory usage around 1MB which also looks real one:

valgrind /usr/local/lib/p7zip/7za x /home/z/Desktop/file.7z

Similary, when I build the code, a bin directory is created there containing 7za executable. If I run it from there, then I again get high and correct memory usage.

I am trying to understand what is the difference in both approaches. Why using installed app (run through sheel script) does not give correct memory usage.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

valgrind is supposed to debug memory related problems for ELF 64-bit or ELF 32-bit exectuables. It can't be used with shell scripts. So you won't be able to debug your application using the shell script.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!