I have a C++ process which is using shared memory to store and transfer data between its child processes. I want to check the shared memory usage while the parent process is executing just like top utility gives a runtime information of cpu and memory.

I am a little sceptical if the memory section in the output of top includes shared memory or not. Does it?

  • top will show not that usage information, you have to do that housekeeping yourself. One other nitpick: user processes never access physical memory, everything is virtual for them. – ott-- Oct 9 '15 at 21:04
  • So when I type "df -h" I get an entry for shm as : tmpfs 252G 0 252G 0% /dev/shm and when I run "free -m" I get the following output: total used free shared buffers cached Mem: 258202 4498 253703 0 152 2523 – Rambo Oct 13 '15 at 14:22
  • Basically the machine has 256 GB RAM and I was wondering, if the number shown in both mean one and the same thing? – Rambo Oct 13 '15 at 14:23

Well, the SHR column is supposed to show shared memory, but keep in mind that this column also includes all dynamically loaded libraries linked with your program.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.