I want to obtain memory usage of a C++ project in Microsoft Visual Sutio 2019 on Win 7 64 bit. I followed the post How to determine CPU and memory consumption from inside a process?
By using this code inside my main function:
#include "windows.h"
#include "psapi.h"
int main()
{
PROCESS_MEMORY_COUNTERS_EX pmc;
GetProcessMemoryInfo(GetCurrentProcess(), (PROCESS_MEMORY_COUNTERS*)&pmc, sizeof(pmc));
SIZE_T virtualMemUsedByMe = pmc.PrivateUsage;
// My function here
}
And when I change my function parameters to increase workloads, the result of virtualMemUsedByMe
is always 2516k.
What is wrong here with me?