macOS: Better approximation for AvailablePhysicalMemory
On macOS, free pages does not seem to be a good indicatur for "available physical memory". Neither inactive ones, but it answers better questions like: "How much memory could this process use in best case scenario".
Free + Inactive aproximately matches Activity Monitor.app output.
I can't find better documentation for this values.
Motivation behind this Merge Request is caused by CMakeFiles that limit number of compiler/linker jobs based on available memory (as reported by CMake). On my machine with 16GB RAM and ~10GB in use (as reported by Activity Monitor), CMake reports 100MB free which is correct for some definition of free, but if requested OS can give way more memory.
Topic-rename: macos-available_memory
Edited by Brad King