In my application i was trying to figure out memory utilization for a particular process in windows machine using below mentioned api.
GetProcessMemoryInfo(hProcess, &info, sizeof(info)); when i checked the value of info.WorkingSetSize it was exactly 14757395258967641292.
So i want to clear whether the returned value is in bytes(for naked eye this cannot be in bytes format)? if not how to convert it into bytes or kilobytes.
void PrintProcessNameAndID( DWORD processID )
{
TCHAR szProcessName[MAX_PATH] = TEXT("<unknown>");
PROCESS_MEMORY_COUNTERS info, info1, info2;
SIZE_T MemoryUsage;
SIZE_T one,two,three, four;
// Get a handle to the process.
HANDLE hProcess = OpenProcess( PROCESS_QUERY_INFORMATION |
PROCESS_VM_READ,
FALSE, processID );
// Get the process name.
if (NULL != hProcess )
{
HMODULE hMod;
DWORD cbNeeded;
if ( EnumProcessModules( hProcess, &hMod, sizeof(hMod),
&cbNeeded) )
{
GetModuleBaseName( hProcess, hMod, szProcessName,
sizeof(szProcessName)/sizeof(TCHAR) );
}
}
// Print the process name and identifier.
//_tprintf( TEXT("%s (PID: %u)"), szProcessName, processID );
GetProcessMemoryInfo(hProcess, &info, sizeof(info));
MemoryUsage = (info.WorkingSetSize);
}