获得一个进程的内存占用 [英] Getting a process's ram usage

查看:177
本文介绍了获得一个进程的内存占用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直有一些麻烦搞清楚我到底如何得到一个进程的内存占用。 (多少RAM是目前消费,没有多少保留,或者其最大或最小)

I have been having some trouble figuring out how exactly I get a process's ram usage. (How much ram it is currently consuming, not how much is reserved, or its max or min)

可以说我有回地面,Java的运行的进程。 exe文件,它允许使用的RAM 1024MB,我怎么能告诉它目前正在使用多少RAM。

Lets say I have a process running in the back ground, Java.exe, it is allowed to use 1024mb of ram, how can I tell how much ram it is currently using.

我开始的过程中我自己,所以我有机会获得Process对象,我只是想多一点澄清什么属性是我的唯一。

I am starting the process myself, so I have access to the Process object, I would just like a little more clarification on what property is the one for me.

推荐答案

如果你是纯粹的感兴趣的物理内存,你可能想 WorkingSet64 ,这给了分配关联进程的物理内存数量。记者了解到,这个值不断波动,和值这个电话给你可能不是最新的。您还可能有兴趣在 PeakWorkingSet64 ,这给的最高金额的由相关联的过程中所使用的物理存储器。

If you are purely interested in physical memory, you probably want WorkingSet64, which gives "the amount of physical memory allocated for the associated process." Understand that this value constantly fluctuates, and the value this call gives you may not be up to date. You may also be interested in PeakWorkingSet64, which gives "the maximum amount of physical memory used by the associated process."

这篇关于获得一个进程的内存占用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆