Original article link
When we view process information in top, there will be two projects: RSS and vsz, the former is the memory usage of the process itself, and the latter is the total usage of the shared library. Memstat smallProgramYou can view the memory usage of each shared library for your convenience.
You can use tools such as top or System Manager to view the memory usage of each process. However, the memory contains not only the processes you run, but also the shared libraries required by the processes, for example, the most basic libc. so. These shared libraries have only one copy in the physical memory and are shared by multiple processes. When we view process information in top, there will be two projects: RSS and vsz, the former is the memory usage of the process itself, and the latter is the total usage of the shared library.
Memstat is a small program that can help you view the memory usage of each shared library and make them exist.
Run memstat-W to list the information of all the current shared libraries:
Memstat-W
If the-W parameter is not added, memstat truncates excessively long information to 80 columns. Effect:
The first column is the memory usage, followed by the full path of the shared library, and the last number is the PID of the shared library process. We can see that many shared libraries are followed by many PIDs, indicates that the shared database is shared by multiple processes.
You can configure the directory of the execution file in/etc/memstat. conf. memstat will only investigate the executable file sharing library information under these directories.
If you want to check that the Shared Library occupies the most memory, you only need to use sort to filter it out:
Memstat-w | sort-Rn
You can ~
Memstat is available in both Debian and Ubuntu, but I didn't find his homepage. If your software repository does not contain memstat, you canLocal downloadThis package is transferred through deb2targz. (Coqin network backup:Memstat_0.5_i386.tar.gz)