1. 程式人生 > >C查詢記憶體大小

C查詢記憶體大小

int GetMemory(void)
{

    MEMORYSTATUSEX statex;
    statex.dwLength = sizeof (statex);
    GlobalMemoryStatusEx (&statex);
    int mem = statex.ullTotalPhys/1024/1024/1000;
    //printf("%d G",statex.ullTotalPhys/1024/1024/1000);//現實記憶體大小
    return mem;
}