Find the answer to your Linux question:
Results 1 to 7 of 7
How to find out the total application memory ? Is there any command for that similar to free command(which gives total physical memory usage)?...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Apr 2012
    Posts
    2

    Question Memory management


    How to find out the total application memory ?
    Is there any command for that similar to free command(which gives total physical memory usage)?

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,748
    The top command will give you virtual memory (virt), resident set size (res), and shared memory (shr) usage stats on all programs running. The resident set size is the most critical item, as that is the memory which is used exclusively by the application in question.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    Aug 2005
    Location
    Ukraine (Little Russia, xUSSR)
    Posts
    6
    use pmap utility

    sudo pmap <pid>

    last line will be "total"

    # pmap 1 | grep total
    total 5616K

  4. $spacer_open
    $spacer_close
  5. #4
    Administrator jayd512's Avatar
    Join Date
    Feb 2008
    Location
    Kentucky
    Posts
    5,023
    +1 for top or htop.
    Jay

    New users, read this first.
    New Member FAQ
    Registered Linux User #463940
    I do not respond to private messages asking for Linux help. Please keep it on the public boards.

  6. #5
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,748
    Quote Originally Posted by GOLDEN_key View Post
    use pmap utility

    sudo pmap <pid>

    last line will be "total"

    # pmap 1 | grep total
    total 5616K
    Bear in mind that includes shared memory segments. The only segments that tell about allocated memory for a process are those whose permissions are rw. r-x segments are code, and r---- are read-only, generally string literals. Better to use pmap -x to get extended information, such as RSS memory. That is memory allocated for the program alone. The total memory includes stuff like system shared libraries, etc. Example, for one of the Chrome processes running my browser pages, the total memory is 981MB (almost a gig), yet the RSS (Resident Set Size) is only 76MB, which is about what each tab takes up when opened.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  7. #6
    Just Joined!
    Join Date
    Apr 2012
    Posts
    2
    Thank you every one for the response.
    Top command output helped.
    But the pmap utility is for a single process. I need for entire machine. I mean total application memory.
    There is something called sysram in QNX which is the application memory total.
    Can someone tell whether is there any similar thing in Linux?

  8. #7
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,748
    Quote Originally Posted by Mithu View Post
    Thank you every one for the response.
    Top command output helped.
    But the pmap utility is for a single process. I need for entire machine. I mean total application memory.
    There is something called sysram in QNX which is the application memory total.
    Can someone tell whether is there any similar thing in Linux?
    Well, here is a shell command that will pull all the pmap data for all processes. It can be modified to pipe the output to other tools which can extract and/or aggregate the totals for each process quite easily.
    Code:
    find /proc -maxdepth 1 -type d -name '[1-9]*' -printf "%f\n" -exec sudo pmap -x {} \;
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

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