From 3943498cc28fabf54b6da62297ff3db8b4306ed9 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Sun, 26 Oct 2014 18:55:44 -0500 Subject: [PATCH] win32_get_avail_memory(): Report 85% of minimum of virtual and physical memory This should be a better prediction of how much memory can actually be allocated. --- src/win32_replacements.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/win32_replacements.c b/src/win32_replacements.c index b282768d..ebf6e20e 100644 --- a/src/win32_replacements.c +++ b/src/win32_replacements.c @@ -73,7 +73,7 @@ win32_get_avail_memory(void) .dwLength = sizeof(status), }; GlobalMemoryStatusEx(&status); - return status.ullTotalPhys; + return (u64)min(status.ullTotalPhys, status.ullTotalVirtual) * 85 / 100; } /* Replacement for POSIX-2008 realpath(). Warning: partial functionality only -- 2.43.0