Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does linux get the memory of a process and monitor

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "how to obtain and monitor the memory of a process by linux". The explanation in this article is simple and clear, easy to learn and understand. Please follow the editor's train of thought to study and learn "linux how to obtain the memory of a process and monitor it".

Through ps, you can know the memory occupied by a process.

$ps-O rss-p 3506

PID RSS S TTY TIME COMMAND

3506 6984 S pts/1 00:00:00 vim

If you want to monitor memory, be sure to use the omnipotent command pidstat for the process (PS: you can tell what the name is for)

#-r display memory information

#-p specify pid

# 1: print every second

$pidstat-r-p 3506 1

Linux 3.10.0-957.21.3.el7.x86_64 (shanyue) 11-04-19 _ x86 CPU 642)

20:47:35 UID PID minflt/s majflt/s VSZ RSS MEM Command

20:47:36 0 3506 0.00 0.00 139940 6984 0.18 vim

20:47:37 0 3506 0.00 0.00 139940 6984 0.18 vim

20:47:38 0 3506 0.00 0.00 139940 6984 0.18 vim

20:47:39 0 3506 0.00 0.00 139940 6984 0.18 vim

20:47:40 0 3506 0.00 0.00 139940 6984 0.18 vim

20:47:41 0 3506 0.00 0.00 139940 6984 0.18 vim

Pidstat is a linux performance tool under sysstat, but how to locate memory changes in mac? The omnipotent top/htop can be used at this time.

$htop-p 31796

Summary

In short, there are three commands

Pidstat-rhtop/top-pps-O rss-p

Thank you for your reading, the above is the content of "how to obtain and monitor the memory of a process by linux". After the study of this article, I believe you have a deeper understanding of how to obtain the memory of a process and monitor this problem, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report