#include <Psapi.h>
#pragma comment(lib, "Psapi.lib")
int GetMemoryInfo()
{
PROCESS_MEMORY_COUNTERS pmc;
memset(&pmc, 0, sizeof(pmc));
pmc.cb = sizeof(PROCESS_MEMORY_COUNTERS);
if (::GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc))) {
printf( "print octal----------------------------------------------------------------------------------------");
printf( "\tPageFaultCount: 0x%08X\n", pmc.PageFaultCount );
printf( "\tPeakWorkingSetSize: 0x%08X\n", pmc.PeakWorkingSetSize );
printf( "\tWorkingSetSize: 0x%08X\n", pmc.WorkingSetSize );
printf( "\tQuotaPeakPagedPoolUsage: 0x%08X\n", pmc.QuotaPeakPagedPoolUsage );
printf( "\tQuotaPagedPoolUsage: 0x%08X\n", pmc.QuotaPagedPoolUsage );
printf( "\tQuotaPeakNonPagedPoolUsage: 0x%08X\n", pmc.QuotaPeakNonPagedPoolUsage );
printf( "\tQuotaNonPagedPoolUsage: 0x%08X\n", pmc.QuotaNonPagedPoolUsage );
printf( "\tPagefileUsage: 0x%08X\n", pmc.PagefileUsage ); 
printf( "\tPeakPagefileUsage: 0x%08X\n", pmc.PeakPagefileUsage );
printf( "print Decimal----------------------------------------------------------------------------------------");
printf( "\tPageFaultCount: %ul\n", pmc.PageFaultCount );
printf( "\tPeakWorkingSetSize: %ul\n", pmc.PeakWorkingSetSize );
printf( "\tWorkingSetSize: %ul\n", pmc.WorkingSetSize );
printf( "\tQuotaPeakPagedPoolUsage: %ul\n", pmc.QuotaPeakPagedPoolUsage );
printf( "\tQuotaPagedPoolUsage: %ul\n", pmc.QuotaPagedPoolUsage );
printf( "\tQuotaPeakNonPagedPoolUsage: %ul\n", pmc.QuotaPeakNonPagedPoolUsage );
printf( "\tQuotaNonPagedPoolUsage: %ul\n", pmc.QuotaNonPagedPoolUsage );
printf( "\tPagefileUsage: %ul\n", pmc.PagefileUsage ); 
printf( "\tPeakPagefileUsage: %ul\n", pmc.PeakPagefileUsage );
printf( "----------------------------------------------------------------------------------------");
}

return pmc.WorkingSetSize;
}