问题描述
在SO上,我已经找到了对该问题的几个答案,但没有一个回答我的问题.我试图在我们的非托管C ++应用程序中查找一些内存泄漏,从阅读以下内容来看,似乎内存-提交大小"是监视内存使用情况时最好的度量标准: http://forum.sysinternals.com/virtual-private-bytes -and-working-set_topic18296.html
I've found several answers to this question here on SO, but none that answers my question.I'm trying to track down some memory leaks in our unmanaged C++ application, and from reading the following, it seems that "Memory - Commit Size" is the best metric to use when monitoring memory usage:http://forum.sysinternals.com/virtual-private-bytes-and-working-set_topic18296.html
以下是Windows Task Manager报告的各种指标的说明: http://windows .microsoft.com/en-us/windows-vista/what-do-the-task-manager-memory-columns-mean
Here's the explanation of the various metrics reported by Windows Task Manager:http://windows.microsoft.com/en-us/windows-vista/what-do-the-task-manager-memory-columns-mean
我发现以下内容描述了如何检索命名进程的工作集数据: http://msdn.microsoft.com/en-us/library/76yt3c0w.aspx
I've found the following that describes how to retrieve the Working Set data for a named process:http://msdn.microsoft.com/en-us/library/76yt3c0w.aspx
System.Diagnostics.Process[] processes =
System.Diagnostics.Process.GetProcessesByName(theprocessName);
System.Diagnostics.Process process = processes[0];
但是,这里没有提到承诺内存:
However, this mentions nothing about Committed Memory:
任何人都可以帮忙吗?保罗
Can anyone help?Paul
推荐答案
您似乎想使用 GetProcessMemoryInfo
.这将填充 PROCESS_MEMORY_COUNTERS
结构.
It looks like you want to use GetProcessMemoryInfo
. This populates a PROCESS_MEMORY_COUNTERS
structure.
您将对该结构感兴趣的关键要素是
The key element of this structure you'll be interested in is
- 收集进程的内存使用信息
- Collecting Memory Usage Information For a Process
这篇关于如何通过C ++检索已提交的内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!