问题描述
我试图从程序本身中找出我的应用程序消耗了多少内存.我要查找的内存使用情况是 Windows 任务管理器进程"选项卡上内存使用情况"列中报告的数字.
I am trying to find out how much memory my application is consuming from within the program itself. The memory usage I am looking for is the number reported in the "Mem Usage" column on the Processes tab of Windows Task Manager.
推荐答案
一个好的起点是 GetProcessMemoryInfo,报告有关指定进程的各种内存信息.您可以将 GetCurrentProcess() 作为进程句柄传递,以获取有关调用进程的信息.
A good starting point would be GetProcessMemoryInfo, which reports various memory info about the specified process. You can pass GetCurrentProcess() as the process handle in order to get information about the calling process.
可能 PROCESS_MEMORY_COUNTERS 的 WorkingSetSize 成员与任务管理器中的 Mem Usage coulmn 最接近,但它不会完全相同.我会尝试使用不同的值来找到最接近您需求的值.
Probably the WorkingSetSize member of PROCESS_MEMORY_COUNTERS is the closest match to the Mem Usage coulmn in task manager, but it's not going to be exactly the same. I would experiment with the different values to find the one that's closest to your needs.
这篇关于如何在C++中获取Windows下的内存使用情况的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)