http://stackoverflow.com/questions/131303/linux-how-to-measure-actual-memory-usage-of-an-application-or-process
Hi,
How do you measure the memory usage of an application or process in Linux? I've read here that "ps" is not an accurate tool to use for this intent.
Thanks, Kenneth
With ps or similiar tools you will only get the amount of memory pages allocated by that process. This number is correct, but:
a) does not reflect the actual amount of memory used by the application, only the amount of memory reserved for it
b) can be misleading if pages are shared, for example by several threads or by using dynamically linked libraries
If you really want to know what amount of memory your application actually uses, you need to run it within a profiler. For example, valgrind can give you insights about the amount of memory used, and, more importantly, about possible memory leaks in your program.
In recent versions of linux, use the smaps subsystem. For example, for a process with a PID of 1234:
cat /proc/1234/smaps
It will tell you exactly how much memory it is using at that time. More importantly, it will divide the memory into private and shared, so you can tell how much memory your instance of the program is using, without including memory shared between multiple instances of the program.
分享到:
相关推荐
A 32-bit process is normally limited to addressing 2 gigabytes (GB) of memory, or 3 GB if the system was booted using the /3G boot switch even if there is more physical memory available. By leveraging...
In Performance Tuning for Linux Servers, a team of IBM's most-experienced Linux performance specialists shows you how to find bottlenecks, measure performance, and identify effective optimizations....
### Terence Tao - An Introduction to Measure Theory #### 知识点概述 本书由著名数学家陶哲轩(Terence Tao)编写,旨在为读者提供一套关于测度论的基础理论介绍。该书作为陶哲轩博客文章及讲义的汇总,不仅...
Understand the concept of an Intelligent System: What it is good for, when you need one, and how to set it up for successDesign an intelligent user experience: Achieve your objectives and produce data...
Stroop color-word test: A screening measure of selective attention to differentiate LD from non LD children P.r?rholugI, in ihe Srhoob Volunie 21, January. I084 STROOP COLOR-WORD TEST: A ...
创建一个安全指标计划是衡量程序化安全成功的关键。在IT领域,尤其是云安全、渗透测试、区块链和数据安全等核心领域,制定有效的安全指标对于确保组织的信息安全实践具有重要意义。以下将详细介绍如何构建一个安全...
This book contains tips, tricks, and techniques to make new and ... And how can you measure how well your application is performing? These are some of the questions that are answered in this book.
As you advance to Ruby performance expert, you’ll learn how profile your code, how to make sense out of profiler reports, and how to make optimization decisions based on them. You’ll make sure slow ...
- Execute the `bandwidthTest` sample to measure the memory bandwidth of the GPU. - Valid results are illustrated in Figure 2 of the NVIDIA CUDA Getting Started Guide for Linux. - **Performance ...
【如何计算运放噪声】 运算放大器(Op Amp)在信号处理系统中广泛使用,而其噪声性能对系统的整体性能至关重要。噪声可以来源于多个因素,包括输入电压噪声、电流噪声和电阻噪声等。理解并计算这些噪声对于优化设计...
Interpretation of the PPVT-R: A pure measure of verbal comprehension? Psychology in fhr School& Volume 2 1 , January 1984 INTERPRETATION OF THE PFVT-R: A PURE MEASURE OF VERBAL COMPREHENSION? ...
Parallax: The Race to Measure the Cosmos(Alan W. Hirshfeld)
Code taken from the PLX PDE tool to show how to measure serdes eye data. This code is only sample source for reference purposes & not an actual running application. - Shared Some common functions ...
量度理论是现代数学分析特别是实分析的基础理论之一,它主要研究集合上的量度及其性质,进而发展成对函数的积分理论。在研究生的实分析课程中,量度理论和积分理论是其核心组成部分,为现代数学诸多分支提供理论基础...