• VMware

    Learn about VMware virtualization for its products like vsphere ESX and ESXi, vCenter Server, VMware View, VMware P2V and many more

  • Linux

    Step by step configuration tutorials for many of the Linux services like DNS, DHCP, FTP, Samba4 etc including many tips and tricks in Red Hat Linux.

  • Database

    Learn installation and configuration of databases like Oracle, My SQL, Postgresql, etc including many other related tutorials in Linux.

  • How to check memory utilization for a specific process ?

    We have a no. of ways to check the overall memory usage but what if you want to monitor memory usage of some particular process.

    To show an example I am running screen utility on my machine so lets try to find the memory used by the same.

    The below command will create a screen with 50 lakhs line buffer by the name of "work"
    # screen -h 5000000 -LS work
    Once I execute this command a new screen will come up on the screen. To detach the screen press "ctrl + a + d"

    Now on the screen lets see the PID of the running screen utility
    # screen -ls
    There is a screen on:
            2598.work       (Detached)
    1 Socket in /var/run/screen/S-root.

    Here the pid for this screen utility is 2598

    Lets check the memory utilization of the same

    Method 1

    using ps command (this will show the memory utilization in percentage)
    # ps -p 2598 v
     2598 ?        Ss     0:03      0   354 938689 821540 42.9 SCREEN -h 5000000 -LS work

    So the screen utility is using 42.9% of my total available memory i.e. 1869 MB so screen is using 801 MB approximately.

    Method 2

    Using top command
    # top -p 2598
     2598 root      20   0  917m 802m  864 S  0.0 42.9   0:03.49 screen

    So the output is similar to what we saw using ps command and it again shows us the %age usage but again there is one more section of VIRT which tells you the virtual memory used by the screen utility.

    Basically Virtual memory is a logical combination of RAM memory and swap space which is used by running process.

    Method 3

    Run the below command using the pid of the screen utility process
    # cat  /proc/2598/status | grep -i VMSIZE
    VmSize:   939044 kB

    This will again show you the virtual memory used by the screen utility i.e. 917 MB

    To understand the difference between Physical Memory, Virtual Memory and Swap space follow the below link
    What is virtual memory, paging and swap space?

    Related Articles:
    How to clear cache memory in Linux
    How to increase Swap memory size in Linux
    What is buffers/cache in free command in Linux ?
    What is swappiness and how do we change its value?

    How to check memory utilization for a specific process ? How to check memory utilization for a specific process ? Reviewed by admin on Sunday, February 22, 2015 Rating: 5

    No comments:

    Powered by Blogger.