I have this problem and can't get solved on this test code.
Invalid arguments Candidates are:
? GetProcessMemoryInfo(?, _PROCESS_MEMORY_COUNTERS *, ?)
How to determine CPU and memory consumption from inside a process?
I tried GetProcessMemoryInfo(GetCurrentProcess(),&info,info.cb); and GetProcessMemoryInfo(GetCurrentProcess(),(*PROCESS_MEMORY_COUNTERS)&info,info.cb); I use mingw64 version MinGW-W64-builds-4.2.0 gcc version 4.9.2 with: -std=c++1y -O0 -g3 -Wall -c -fmessage-length=0 I tried adding path and includes, added -lpaspi to the gcc++ build parameters in eclipse but nothing seems to help. any ideas?
#include <windows.h>
#include <psapi.h>
LPVOID file_version;
HANDLE handle;
PROCESS_MEMORY_COUNTERS_EX info;
MEMORYSTATUSEX memoryInfo;
DWORDLONG totalVirtualMemory;
DWORDLONG virtualMemoryUsed;
SIZE_T virtualMemoryUsedByMe;
DWORDLONG totalPhysicalMemory;
DWORDLONG physicalMemoryUsed;
SIZE_T physicalMemoryUsedByMe;
void init(){
          bool error  =  GetFileVersionInfo("psapi.lib",0,GetFileVersionInfoSize("psapi.h",0),file_version);
          info.cb = sizeof(info);
            bool okay = GetProcessMemoryInfo(GetCurrentProcess(),(*PROCESS_MEMORY_COUNTERS)&info,info.cb);                      
           memoryInfo.dwLength = sizeof(MEMORYSTATUSEX);
          GlobalMemoryStatusEx(&memoryInfo);
          totalVirtualMemory = memoryInfo.ullTotalPageFile;//Total Virtual Memory:
          virtualMemoryUsed = memoryInfo.ullTotalPageFile - memoryInfo.ullAvailPageFile;//Virtual Memory currently used:
}
double GetCurrentValue(){
     HANDLE handle = GetCurrentProcess();
     info.cb = sizeof(info);
     GetProcessMemoryInfo(handle, (PROCESS_MEMORY_COUNTERS*)&info,info.cb);
     virtualMemoryUsedByMe = info.PrivateUsage; //Virtual Memory currently used by current process:
     totalPhysicalMemory = memoryInfo.ullTotalPhys;//Total Physical Memory (RAM):
     physicalMemoryUsed = memoryInfo.ullTotalPhys - memoryInfo.ullAvailPhys;//Physical Memory currently used:
     physicalMemoryUsedByMe = info.WorkingSetSize;//Physical Memory currently used by current process:
}
 
     
    