Как узнать, сколько памяти занимает процесс?
#include <iostream> #include <windows.h> #include <psapi.h>//Psapi.lib using namespace std; int main() { DWORD pid; PROCESS_MEMORY_COUNTERS pmc; cout<<"Enter process PID: ";cin>>pid; HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS,FALSE,pid); if(NULL != hProcess) { if(GetProcessMemoryInfo(hProcess,&pmc,sizeof(pmc))) { cout<<pmc.cb<<endl; cout<<pmc.PageFaultCount/1024<<endl; cout<<pmc.PeakWorkingSetSize/1024<<endl; cout<<pmc.WorkingSetSize/1024<<endl; cout<<pmc.QuotaPeakPagedPoolUsage/1024<<endl; cout<<pmc.QuotaPagedPoolUsage/1024<<endl; cout<<pmc.QuotaPeakNonPagedPoolUsage/1024<<endl; cout<<pmc.QuotaNonPagedPoolUsage/1024<<endl; cout<<pmc.PagefileUsage/1024<<endl; cout<<pmc.PeakPagefileUsage/1024<<endl; } } CloseHandle( hProcess ); return 0; }