On 3GB Windows 7 (32bit) i get 2gb of ram. Windows itself is reporting 3GB of RAM (Computer->Properties).
Is this ok (due to the limit of 32bit platform) or is this a bug ?
Hmm. Looks like there’s a more up-to-date function that we should be using - does this work?
int SystemStats::getMemorySizeInMegabytes() throw()
{
MEMORYSTATUSEX mem;
GlobalMemoryStatusEx (&mem);
return (int) (mem.ullTotalPhys / (1024 * 1024)) + 1;
}
almost:
MEMORYSTATUSEX statex;
statex.dwLength = sizeof (statex);
GlobalMemoryStatusEx (&statex);
return (int) (statex.ullTotalPhys / (1024 * 1024)) + 1;
seems to work fine (extracted from MSDN)
Thanks!