获取进程内存 [英] Get Process Memory

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

问题描述


我需要在给定的时间点获取我的进程的内存消耗,这通常显示在窗口的任务管理器中。


我尝试使用  GetProcessMemoryInfo API并收集了  PROCESS_MEMORY_COUNTERS。但是需要了解,如何在任务管理器中获得过程显示的精确/近似记忆。


还有其他更好的方法可以获得。


谢谢

解决方案

您好
LokanathNayak,


感谢您在此处发帖。


>>我尝试使用  GetProcessMemoryInfo API并收集了  PROCESS_MEMORY_COUNTERS。但需要了解的是,如何在任务管理器中为流程显示流程的确切/几乎记忆。


据我所知,PROCESS_MEMORY_COUNTERS的WorkingSetSize成员是与任务管理器中的Mem Usage列最接近的匹配,但它不会完全相同。


以下是您作为参考的示例代码。


https://msdn.microsoft.com/en-us/library/windows/desktop/ms682050(v = VS。 85).aspx


希望这可以帮到你。


最好的问候,

Sera Yu



Hi,

I need to get the memory consumption for my process at a given point of time, which normally displays in task manager of window.

I tried using the GetProcessMemoryInfo APIand i collected the PROCESS_MEMORY_COUNTERS. But needtounderstand, how to get the exact/nearly memory of the process display in taskmanager for the process.

Is there any other better way to get.

Thanks

解决方案

Hi LokanathNayak,

thanks for posting here.

>>I tried using the GetProcessMemoryInfo APIand i collected the PROCESS_MEMORY_COUNTERS. But needtounderstand, how to get the exact/nearly memory of the process display in taskmanager for the process.

As far as I know,  the WorkingSetSize member of PROCESS_MEMORY_COUNTERS is the closest match to the Mem Usage column in task manager, but it's not going to be exactly the same.

Here is a sample code for you as a reference.

https://msdn.microsoft.com/en-us/library/windows/desktop/ms682050(v=vs.85).aspx

Hope this could be help of you.

Best Regards,
Sera Yu


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

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