LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   I need to know the exact amount of static memory being reserved by my program in C (http://www.linuxquestions.org/questions/programming-9/i-need-to-know-the-exact-amount-of-static-memory-being-reserved-by-my-program-in-c-320858/)

grupoapunte 05-06-2005 06:13 PM

I need to know the exact amount of static memory being reserved by my program in C
 
Hi, im makeing a program in C, and i need to know the exact amount of static memory that im reserving for structs and vars, I already tryed to make a count but the program is too long, does anyone knows a program to make that or a usefull way?

Tanks to all Dam.

Mara 05-06-2005 07:01 PM

Valgrind shows memory usage, but it's written mostly for finding dynamic memory problems. For static variable I'd look into elf (executable) structure. It's possible if you're writing for Linux (Unix). Is it true?

randyding 05-06-2005 11:31 PM

You'll want to read the map file, usually generated by the linker.
I think you can also get a map printout from an already compiled program, possibly by using
ld -M programname


All times are GMT -5. The time now is 10:07 PM.