Download your favorite Linux distribution at LQ ISO.
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 11-13-2006, 02:56 AM   #1
Registered: Sep 2004
Location: Hyderabad.
Posts: 83

Rep: Reputation: 15
memory occupied by a program

I want to find out total memory occupeid by a program at run time.
One problem is my program uses dynamic memory allocation at some points of code. Can any body please tell me how to find out actual memory taken by the program. ( I think i cant take the size of .out file)
Thanks in advance.

Old 11-13-2006, 08:53 AM   #2
Registered: Jun 2006
Location: Belarus
Distribution: Debian GNU/Linux testing/unstable
Posts: 471

Rep: Reputation: 40
Did you tried ps -eF <processname>?
Old 11-15-2006, 06:30 AM   #3
Registered: Aug 2003
Location: 63123
Distribution: OpenSuSE/Ubuntu
Posts: 419

Rep: Reputation: 35
You can't find out how much memory a program may use if it employs dynamic memory. The whole idea of dynamic memory is that it is not a predetermined amount. There is no way of guessing whether an app will open a 1kb file or a 1gb file.
Old 11-15-2006, 10:07 AM   #4
Registered: Apr 2002
Location: Windsor, ON, CA
Distribution: Ubuntu
Posts: 740

Rep: Reputation: 32
Check out the dmalloc library. It's very simple to use, and provides lots of good info about your dynamic memory usage.


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
Sound card be occupied by only one program at a time hqking Linux - Hardware 2 05-02-2005 03:13 AM
getting memory from other program coredump2005 Programming 4 02-23-2005 02:49 PM
How to do memory management of a program in C? Franziss Programming 8 12-13-2004 02:52 AM
memory leaking in Qt program ih1008 Programming 0 10-08-2004 07:49 PM
Memory Leak when using memory debugging C program on SuSE SLES8 babalina Linux - Distributions 0 10-06-2003 09:39 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:38 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration