windows - 我的 Windows 应用程序真正使用了多少内存?

标签 windows memory taskmanager

我有一个长期运行的实验程序的内存占用,我想知道它的实际内存占用。任务管理器说(在 windows7-64 中)该应用程序正在消耗 800 mb 的内存,但根据任务管理器的说法,分配的内存总量为 3.7gb。所有分配内存的总和不等于 3.7gb。如何动态确定我的应用程序实际消耗了多少内存。

推论:任务管理器实际报告的内存是多少?似乎并不是所有内存都分配给了应用程序本身。

最佳答案

据我了解,任务管理器显示的是工作集;

working set: The set of memory pages recently touched by the threads of a process. If free memory in the computer is above a threshold, pages are left in the working set of a process even if they are not being used. When free memory falls below a threshold, pages are trimmed from the working set.

通过 http://msdn.microsoft.com/en-us/library/cc432779(PROT.10).aspx

您也可以让任务管理器显示虚拟内存。

我通常使用 perfmon (Start -> Run... -> perfmon) 来跟踪内存使用情况,使用 Private Bytes 计数器。它反射(reflect)了您的正常分配器(new/HeapAlloc/malloc 等)分配的内存。

关于windows - 我的 Windows 应用程序真正使用了多少内存?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1166502/

相关文章:

python - 安装Python GTK

c - 以编程方式查找单词含义并将其打印到文件

c++ - 创建一个 array2D 类在编译时崩溃

windows - Windows 任务管理器和任务列表中显示不同的内存使用情况

c++ - 如何在 C++ 任务管理器上更改进程的名称?

windows - 为 Windows 编写虚拟打印机驱动程序

Node.js 升级仍然在 Windows 中显示旧版本

c - 分配连续物理内存的方法

c - 确定 C 中动态分配内存的大小

open-source - 最佳开源在线任务管理/项目经理?