Memstat-view memory usage of Linux shared libraries

Source: Internet
Author: User

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)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.