SystemInformation: Improve Get(Available/Total)VirtualMemory for windows

Currently kwsys can only return ullTotalVirtual, which is not
a very useful value, as memory allocation will fail if we exhaust
the ullTotalPageFile limit.

For example, on a windows workstation, GlobalMemoryStatusEx
returns:
ullTotalVirtual = 128TB
ullTotalPageFile = 16GB

This commit updates the function Get(Available/Total)VirtualMemory to
use page file size.

Change-Id: I461e5f0a975432c31fc7370efe8467c61fea1bb3
parent dec9c30b
......@@ -3753,9 +3753,9 @@ bool SystemInformationImplementation::QueryWindowsMemory()
}
# define MEM_VAL(value) ull##value
# endif
tv = ms.MEM_VAL(TotalVirtual);
tv = ms.MEM_VAL(TotalPageFile);
tp = ms.MEM_VAL(TotalPhys);
av = ms.MEM_VAL(AvailVirtual);
av = ms.MEM_VAL(AvailPageFile);
ap = ms.MEM_VAL(AvailPhys);
this->TotalVirtualMemory = tv>>10>>10;
this->TotalPhysicalMemory = tp>>10>>10;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment