Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 05-06-2005, 05:13 PM   #1
LQ Newbie
Registered: Apr 2005
Posts: 26

Rep: Reputation: 15
Question 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.
Old 05-06-2005, 06:01 PM   #2
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,571

Rep: Reputation: 180Reputation: 180
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?
Old 05-06-2005, 10:31 PM   #3
Registered: May 2004
Posts: 552

Rep: Reputation: 31
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


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
check amount of memory naijaguy Linux - General 4 10-15-2008 02:11 PM
Reducing Reserved memory in montavista linux sudip06 Debian 0 10-13-2005 06:06 AM
Increasing the amount of cached memory balteo Linux - General 1 09-16-2005 04:06 PM
checking amount of free memory sanjith11 Linux - Software 6 05-13-2004 10:11 AM
X uses an excessive amount of memory! ~80Mb kamstrup Linux - Software 3 08-18-2003 06:42 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:02 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration