pmc

C++得到当前进程所占用的内存

血红的双手。 提交于 2020-01-22 12:05:21
//使用SDK的PSAPI (Process Status Helper) //中的 //BOOL GetProcessMemoryInfo( // HANDLE Process, // PPROCESS_MEMORY_COUNTERS ppsmemCounters, // DWORD cb //); // //typedef struct _PROCESS_MEMORY_COUNTERS { // DWORD cb; // DWORD PageFaultCount; // SIZE_T PeakWorkingSetSize; //峰值内存使用 // SIZE_T WorkingSetSize; //内存使用 // SIZE_T QuotaPeakPagedPoolUsage; // SIZE_T QuotaPagedPoolUsage; // SIZE_T QuotaPeakNonPagedPoolUsage; // SIZE_T QuotaNonPagedPoolUsage; // SIZE_T PagefileUsage; //虚拟内存使用 // SIZE_T PeakPagefileUsage; //峰值虚拟内存使用 //} PROCESS_MEMORY_COUNTERS, //*PPROCESS_MEMORY_COUNTERS; #include <iostream>

How to get the Memory Used by a Delphi Program

匿名 (未验证) 提交于 2019-12-03 01:27:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I know how to get the System memory use using GlobalMemoryStatusEx, but that tells me the what the entire OS is using. I really want my program to report how much memory it alone has allocated and is using. Is there any way within my Delphi 2009 program to call either a Windows function or maybe some FastMM function to find out the memory that has been allocated by my program alone? Revisiting my question, I have now changed my accepted answer to the GetMemoryManagerState answer by @apenwarr. It produced identical results to the