8357570: [macOS] os::Bsd::available_memory() might return too low values

Reviewed-by: clanger, mdoerr, lucy
This commit is contained in:
Matthias Baesken 2025-06-11 13:32:57 +00:00
parent 42ab8fcfb9
commit 7d7fc69355

View File

@ -154,7 +154,8 @@ julong os::Bsd::available_memory() {
assert(kerr == KERN_SUCCESS,
"host_statistics64 failed - check mach_host_self() and count");
if (kerr == KERN_SUCCESS) {
available = vmstat.free_count * os::vm_page_size();
// free_count is just a lowerbound, other page categories can be freed too and make memory available
available = (vmstat.free_count + vmstat.inactive_count + vmstat.purgeable_count) * os::vm_page_size();
}
#endif
return available;