c++ かつ windows 環境におけるメモリ使用量の取得方法
#include <windows.h>
#include <psapi.h>
int main() {
HANDLE hProc = GetCurrentProcess();
PROCESS_MEMORY_COUNTERS_EX pmc;
BOOL isSuccess = GetProcessMemoryInfo(
hProc,
(PROCESS_MEMORY_COUNTERS*)&pmc,
sizeof(pmc));
CloseHandle(hProc);
if (isSuccess == FALSE) return EXIT_FAILURE;
std::cout << pmc.PrivateUsage << std::endl;
return EXIT_SUCCESS;
}