mercredi 17 octobre 2018

Which tool or command gives very accurate memory usage status in Linux?

I have been asked in my project to profile memory usage of a C++ application that runs on Linux for an embedded like device. We need to know this in order to decide how much RAM we need.

I have done some research and found many tools or commands to find the max memory usage of a process when it is running.

Here are those:

1) top Command: top -p $Pid

2) ps Command: ps -o rss=$pid

3) pmap Command: pmap -x $pid

4) valgrind -massif valgrind --tool=massif --pages-as-heap=yes program

5) smaps Used the following link: Script

6) Linux system monitor app

But I get different memory usage in each of those. I have tried to understand in depth, but left me confused which is close enough to trust. So someone with experience could share which one they use and also why we have these many ways to measure memory which gives different results.

VM, RSS and Shared parts are having different values in all of them.

Thanks

Aucun commentaire:

Enregistrer un commentaire