Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 03-26-2009, 06:02 AM   #1
Registered: Mar 2007
Posts: 44

Rep: Reputation: 16
Binaries build with -g option takes more memory?

In my application it looks like binaries which are build with debugging symbols (i.e g++ with -g option) taking more memory. My application is linked with lots of external third party libraries. All these third party libraries and my application are build with g++ -g option.
As my application run for long time (say 1 week) with load I see my application using big memory (high virt and RSS ). As per the memory detection tools (valgraind), my application has no memory leaks. All the memory leaks are reported in third party libraries.
Here my question is will the binaries having debugging symbol increases the memory usage?. I understand there may be actual memory leaks in the application. But will binaries build with -g options adds more leak to this. I suspect this because binaries build with -g option may need additional space to keep track of allocate memory details. Also amount of starting memory require to load the binaries (build with -g)to memory will also be high.

Thanks in advance.
Old 03-26-2009, 08:17 AM   #2
Registered: Jan 2009
Location: /dev/ph
Distribution: Fedora, Ubuntu, Redhat, Centos
Posts: 299

Rep: Reputation: 62
> will the binaries having debugging symbol increases the memory usage?.
Old 03-27-2009, 12:58 AM   #3
Valery Reznic
ELF Statifier author
Registered: Oct 2007
Posts: 676

Rep: Reputation: 137Reputation: 137
Originally Posted by Manjunath1847 View Post
Here my question is will the binaries having debugging symbol increases the memory usage?.
No. For sure binary with debug information will take more disk space but not more RAM

Debug information is stored in the part of the executable files that never loaded in the RAM. When debugger need this info it take it from the file, not from the running process.

The only parts of the executable that are loaded in the RAM are PT_LOAD segments.

As simple test you can build same executable twice - with and without debug option and compare 'readelf -l your_executable' output.

PT_LOAD segment should be same
Old 03-27-2009, 12:17 PM   #4
Registered: Mar 2007
Posts: 44

Original Poster
Rep: Reputation: 16
Thanks a lot


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
X takes 460+ megs of memory Gunark Linux - General 15 04-15-2010 07:29 AM
Oracle 10g takes 99% memory utilization of the Linux/AIX server , always! shipon_97 AIX 3 05-16-2008 03:48 AM
Kernel no option for agpgart build for Gentoo. davimint Linux - Hardware 0 03-20-2007 06:28 PM
Build i386 binaries based on i386 shared libraries .so linuxcrazyguy Linux - Software 0 03-19-2007 05:27 PM
Suddenly my system takes twice the memory Imerion Linux - General 5 12-21-2005 06:19 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:49 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration