LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Binaries build with -g option takes more memory? (http://www.linuxquestions.org/questions/linux-software-2/binaries-build-with-g-option-takes-more-memory-714551/)

Manjunath1847 03-26-2009 06:02 AM

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.

fpmurphy 03-26-2009 08:17 AM

> will the binaries having debugging symbol increases the memory usage?.
Yes

Valery Reznic 03-27-2009 12:58 AM

Quote:

Originally Posted by Manjunath1847 (Post 3488263)
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

Manjunath1847 03-27-2009 12:17 PM

Thanks a lot


All times are GMT -5. The time now is 09:25 PM.