如何确定一个进程"虚拟大小" (操作系统)? [英] How to determine a process "virtual size" (WinXP)?

查看:233
本文介绍了如何确定一个进程"虚拟大小" (操作系统)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个需要大量内存的程序,并尽快达到2GB的虚拟地址空间崩溃。 Sysinternals的进程资源管理器显示此虚拟大小一栏。
我怎么能确定这个虚拟大小与C(或C ++)code?

I have a program that needs a lot of memory, and it crashes as soon as the 2GB virtual address space is reached. Sysinternals process explorer displays this as "virtual size" column. How can I determine this "virtual size" with C (or C++) code?

好吧,我要查询虚拟字节性能计数器。性能监视器显示了查询字符串(或它是如何调用),例如,'\\过程(火狐)\\此Virtuelle GROSSE我的德国Win XP的安装。

Ok, I have to query a performance counter for "Virtual Bytes". Perfmon shows the query string (or how it is called) as, for example, '\Process(firefox)\Virtuelle Größe' on my German Win XP installation.

我如何确定为'当前进程'的查询字符串,并且是有非本地化名称呢?

How do I determine the query string for the 'current process', and is there a non-localized name for it?

推荐答案

MSDN:内存性能信息 PROCESS_MEMORY_COUNTERS_EX.PrivateUsage 是一样的虚拟机在Windows XP大小在任务管理器。 GetProcessMemoryInfo 应该工作:

According to MSDN: Memory Performance Information PROCESS_MEMORY_COUNTERS_EX.PrivateUsage is the same as VM Size in Task Manager in Windows XP. GetProcessMemoryInfo should work:

PROCESS_MEMORY_COUNTERS_EX pmcx = {};
pmcx.cb = sizeof(pmcx);
GetProcessMemoryInfo(GetCurrentProcess(),
    reinterpret_cast<PROCESS_MEMORY_COUNTERS*>(&pmcx), pmcx.cb);

现在 pmcx.PrivateUsage 持有的过程中VM的大小。

Now pmcx.PrivateUsage holds the VM Size of the process.

这篇关于如何确定一个进程&QUOT;虚拟大小&QUOT; (操作系统)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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