There are plenty of tools when it comes to monitoring memory usage. The main purpose of using tools like these is to identify any leaks and to know any performance issue that can occur to our program.
Linux natively has tools like 'top', 'pmap' etc. Apart from that Java provides a tool called 'jconsole', I love this tool than any other tool.
Use this command if you would like to monitor all the process
Use this one if you would like to monitor for a particular process
If you would like to record the memory utilization over time, then execute the top command with '-b' option which will output the status ever 'n' seconds
As you can see from the output, it will just tell the percentage of utilization and it will not break the process any further.
Linux natively has tools like 'top', 'pmap' etc. Apart from that Java provides a tool called 'jconsole', I love this tool than any other tool.
1 top
This command is very much similar to what we see in Windows Task Manager. This one shows the real-time memory usage and CPU utilization by each process. We can also monitor for a particular process by passing 'pid' as a command argument.
$top
Use this command if you would like to monitor all the process
$top -p 29257
Use this one if you would like to monitor for a particular process
$top -p 29257 -b > /home/venkatesh/memory_footprint.txt
If you would like to record the memory utilization over time, then execute the top command with '-b' option which will output the status ever 'n' seconds
As you can see from the output, it will just tell the percentage of utilization and it will not break the process any further.
2 pmap
pmap will give the snapshot of the process's memory map. It even provides addresses of the each jar that this process has. What I understand is, it is showing only the static memory usage by the processor and does not tells how much it is taking at runtime.
$pmap -x 29257
We can also get the memory map for multiple processes as well.