From: Eric Biggers Date: Sun, 26 Oct 2014 23:55:44 +0000 (-0500) Subject: win32_get_avail_memory(): Report 85% of minimum of virtual and physical memory X-Git-Tag: v1.7.3~8 X-Git-Url: https://wimlib.net/git/?p=wimlib;a=commitdiff_plain;h=3943498cc28fabf54b6da62297ff3db8b4306ed9 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. --- 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