Thread: memory checking a daemon using top

  1. #1
    Registered User
    Join Date
    Aug 2002
    Posts
    351

    memory checking a daemon using top

    hi there,

    i'm using top to check the memory allocated to a daemon i have written in c. the daemon executes a cycle every 3 minutes. during a cycle memory is allocated and freed. (i've checked for memory leaks and overflows using dmalloc, and everything is fine.)

    although top shows that there are no drastic problems, the SIZE and RSS columns give ranging figures that don't seem to tally with the 3 minute cycle. for example, when the process starts it usually is allocated about 800k, but this can fluctuate 2 hours later to 1200k or 600k.

    surely, every 3 minutes, i should see memory allocated and then deallocated afterwards.

    so, does linux allocate memory like this (i.e. is this normal)?

    is top giving me the right information?

    have i got problems with my code?

    TIA, rotis23

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    I don't know about Linux specifically, but this may help.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  3. #3
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Originally posted by vVv
    Linux only allocates your requested memory when it's really used, ie you write to it.
    That'll be this one then.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  4. #4
    Registered User
    Join Date
    Aug 2002
    Posts
    351
    thanks..

    7.25 was what i was looking for.

    i suppose this is all at the discretion of the compiler working within the limits of the os memory management.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Mutex and Shared Memory Segment Questions.
    By MadDog in forum Linux Programming
    Replies: 14
    Last Post: 06-20-2010, 04:04 AM
  2. Checking for memory leaks
    By Bladactania in forum C Programming
    Replies: 5
    Last Post: 02-10-2009, 12:58 PM
  3. Interpreter.c
    By moussa in forum C Programming
    Replies: 4
    Last Post: 05-28-2008, 05:59 PM
  4. Is it necessary to write a specific memory manager ?
    By Morglum in forum Game Programming
    Replies: 18
    Last Post: 07-01-2002, 01:41 PM
  5. Stack functions as arrays instead of node pointers
    By sballew in forum C Programming
    Replies: 8
    Last Post: 12-04-2001, 11:13 AM