Skip to content

Fix getUsableMemory() and getFreeSwapMemory() on Windows#209

Open
marcosfrm wants to merge 1 commit into
CauldronDevelopmentLLC:masterfrom
marcosfrm:win-mem
Open

Fix getUsableMemory() and getFreeSwapMemory() on Windows#209
marcosfrm wants to merge 1 commit into
CauldronDevelopmentLLC:masterfrom
marcosfrm:win-mem

Conversation

@marcosfrm

Copy link
Copy Markdown
Contributor

ullAvailPhys is the closest equivalent to Linux's MemAvailable. MEMORYSTATUSEX does not expose a separate MemFree-like value.

For swap, ullAvailPageFile includes space that can be committed to physical memory, so we subtract ullAvailPhys to approximate the actual free swap space, following Zabbix's approach:

https://github.com/zabbix/zabbix/blob/7.4.11/src/libs/zbxsysinfo/win32/swap.c#L130-L137

Closes #208

ullAvailPhys is the closest equivalent to Linux's MemAvailable. MEMORYSTATUSEX does not expose a separate
MemFree-like value.

For swap, ullAvailPageFile includes space that can be committed to physical memory, so we subtract ullAvailPhys to
approximate the actual free swap space, following Zabbix's approach:

https://github.com/zabbix/zabbix/blob/7.4.11/src/libs/zbxsysinfo/win32/swap.c#L130-L137

Closes CauldronDevelopmentLLC#208
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Potential incorrect values in getUsableMemory() and getFreeSwapMemory() on Windows

1 participant