windows 监控桌面堆内存
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5810046/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
monitoring desktop heap memory
提问by MK.
Is there any way to figure out which application is using up all the desktop heap memory?
有什么办法可以找出哪个应用程序用完了所有桌面堆内存?
For an explanation of 'desktop heap' see this MSDN blog.
有关“桌面堆”的说明,请参阅此 MSDN 博客。
EDIT: If you don't know what "desktop heap memory" is please don't answer.
编辑:如果您不知道什么是“桌面堆内存”,请不要回答。
EDIT2: if you don't know what "desktop heap memory" is don't vote to close the question.
EDIT2:如果你不知道什么是“桌面堆内存”,不要投票结束这个问题。
回答by Alois Kraus
According to this blogpost you should look for the user objects. To find the bad application you can configure the USER Objects column within Process Explorer. Then sort descending by user objects. User Objects are all GUI objects like Windows, Toolbars, Icons, Cursors ... The process with the highest values is very likely the bad one.
根据这篇博客文章,您应该查找用户对象。要查找不良应用程序,您可以在 Process Explorer 中配置 USER Objects 列。然后按用户对象降序排序。用户对象都是 GUI 对象,如 Windows、工具栏、图标、光标……具有最高值的进程很可能是坏进程。
Direct link to download: DHeapMonfrom microsoft.
直接下载链接:来自微软的DHeapMon。
回答by tank56d
Disclaimer: I work for Microsoft, and these are my personal thoughts and experiences which may or may not reflect current or future Microsoft policies/procedures/etc.
免责声明:我为 Microsoft 工作,这些是我的个人想法和经验,可能会或可能不会反映当前或未来的 Microsoft 政策/程序/等。
I know this is old, but since I stumbled across it I wanted to provide some feedback/answers.
我知道这是旧的,但由于我偶然发现它,我想提供一些反馈/答案。
Desktop Heap Monitor does not work on Vista+. DHeapMon depended on the ability to patch kernel binaries to track desktop heap- this behavior is blocked, which is why it doesn't work.
桌面堆监视器不适用于 Vista+。DHeapMon 依赖于修补内核二进制文件以跟踪桌面堆的能力 - 这种行为被阻止,这就是它不起作用的原因。
To monitor desktop heap yourself, all you can do is look at user objects (unfortunately).
要自己监视桌面堆,您所能做的就是查看用户对象(不幸的是)。
To get a complete answer, you can open a support ticket with Microsoft and with a kernel or complete dump (NOT a process dump!) and they can inspect the heap and provide you some information. It is extracted from the dump file via a debugger extension, which I wrote.
要获得完整的答案,您可以通过 Microsoft 和内核或完整转储(不是进程转储!)打开支持票,他们可以检查堆并为您提供一些信息。它是通过我编写的调试器扩展从转储文件中提取的。
Limitations:
限制:
Only works from kernel mode. Even though a desktop heap mapping exists in user mode, the extension does not support it. Even if I added support for user mode debugging of desktop heap, it would be limited as some of the related data is only in kernel mode. Changes on recent builds of Windows 10 might restrict it further, so I have not invested time to add user mode support.
It can't measure what isn't in the dump. In other words, if the desktop heap is missing pages it will do its best but it will obviously lose accuracy.
Does not support Windows 10 build 1809 or Server 2019, yet, due to changes to the heap manager.
仅适用于内核模式。即使用户模式中存在桌面堆映射,扩展也不支持它。即使我添加了对桌面堆的用户模式调试的支持,它也会受到限制,因为一些相关数据仅在内核模式下。最近 Windows 10 版本的更改可能会进一步限制它,因此我没有花时间添加用户模式支持。
它无法衡量垃圾场中没有的东西。换句话说,如果桌面堆缺少页面,它会尽力而为,但显然会失去准确性。
由于堆管理器的更改,尚不支持 Windows 10 build 1809 或 Server 2019。
Happy coding!
快乐编码!
回答by Jess
If you want to do it within your program, C++ can use WMI to find the culprit.
如果你想在你的程序中这样做,C++ 可以使用 WMI 来找到罪魁祸首。