LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 05-06-2005, 05:13 PM   #1
grupoapunte
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
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
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
randyding
Member
 
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
 
  


Reply



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

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:12 AM.

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