[Ilugc] How to callculate the memory occupied by a c program when it is executing

  • From: steve@xxxxxxxxxxxx (steve)
  • Date: Wed Sep 30 22:52:48 2009

On 09/30/2009 11:10 AM, Balachandar wrote:

HI luggies,
    I have some optimized c code snippets. I want to know how much memory it
takes before and after optimization.Is there any tool for it??


Hmm, in my enthusiasm to participate in a flame, i forgot to reply to this, 
although i did have a couple of suggestions :).

Somebody already mentioned valgrind. There is also pmap which is good for a 
quick 'point-in-time' snapshot of process memory space (man pmap) or just
$ cat /proc/<pid>/status

...or even "ps l"

hth,
cheers,
- steve

-- 
random non tech spiel: http://lonetwin.blogspot.com/
tech randomness: http://lonehacks.blogspot.com/
what i'm stumbling into: http://lonetwin.stumbleupon.com/

Other related posts: