The only program relevant I know of is pmap
, but this only prints the memory of one process.
I would like to see how the physical memory is occupied and by which processes/library, including the kernel, of the entire physical RAM (as opposed to that from the process' POV with pmap
).
Ideally also with a graphical interface.
Do you know if there's any such tool?
I know about the ambiguity introduced by libraries. If it's the case, it could display a 1-pixel wide line and an arrow to the real location of that library.
What do I need this for? To view the RAM fragmentation.
Memory Fragmentation
When a Linux system has been running for a while memory fragmentation can increase which depends heavily on the nature of the applications that are running on it. The more processes allocate and free memory, the quicker memory becomes fragmented. And the kernel may not always be able to defragment enough memory for a requested size on time. If that happens, applications may not be able to allocate larger contiguous chunks of memory even though there is enough free memory available. Starting with the 2.6 kernel, i.e. RHEL4 and SLES9, memory management has improved tremendously and memory fragmentation has become less of an issue.
To see memory fragmentation you can use the magic SysRq key. Simply execute the following command:
This command will dump current memory information to /var/log/messages. Here is an example of a RHEL3 32-bit system:
The first line shows DMA memory fragmentation. The second line shows Low Memory fragmentation and the third line shows High Memory fragmentation. The output shows memory fragmentation in the Low Memory area. But there are many large memory chunks available in the High Memory area, e.g. 28 4MB.
If memory information was not dumped to /var/log/messages, then SysRq was not enabled. You can enable SysRq by setting sysrq to 1:
Starting with the 2.6 kernel, i.e. RHEL4 and SLES9, you don’t need SysRq to dump memory information. You can simply check /proc/buddyinfo for memory fragmentation.
Here is the output of a 64-bit server running the 2.6 kernel:
In this example I used SysRq again to show what each number in /proc/buddyinfo is referring to.
Source: http://www.puschitz.com/pblog/