Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Getting memory footprint of a process

    I've written a data cache that loads a bunch of data from a database and loads it into memory so front end applications can query the data much faster.

    My problem is accurately finding out the memory footprint of the process (mainly, the data footprint). I have tried using top, and catting both /proc/PID/statm and /proc/PID/status with no real luck. For example, I perform a load and get the following results:

    cat statm:

    328394 290990 399 30 0 324378 0

    cat status:

    VmSize: 1313576 kB
    VmLck: 0 kB
    VmRSS: 1163960 kB
    VmData: 1297492 kB
    VmStk: 20 kB
    VmExe: 121 kB
    VmLib: 3483 kB
    StaBrk: 00573000 kB
    Brk: 4c4dd000 kB
    StaStk: 7fbffff9b0 kB


    1282m 1.1g 1596

    Top and status seem to agree with each other in the region of 1.3GB (smstat reports about 300MB!), but when I've performed other small size tests (e.g. creating 5m element array, 50m element array etc.), statm seems to return the most sane results.

    Does anyone have any detailed knowledge of this and give me a hand?



  2. #2

    /stat is in pages and /status is in kb

    I think you are missing something here. /proc/pid/statm reports its numbers in pages (4096 byte chunks) and /proc/pid/status reports its numbers in kb (1024 byte chunks). Therefore, the number 328394 in pages is the same as 1313576 in kb (328394 x 4 = 1313576). The numbers are identical.

    I don't think you have any problem here at all.
    Last edited by bleurose; 04-02-2006 at 03:24 AM. Reason: Add title

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts