use specific implementation to get available host memory on MacOS#2597
use specific implementation to get available host memory on MacOS#2597
Conversation
herve-gross
left a comment
There was a problem hiding this comment.
The code now compiles without issues on my Mac. Thanks for fixing this!
|
|
||
| return vmstat.free_count * pagesize; | ||
| #else | ||
| GEOS_ERROR_IF( percent > 100, "Error, percentage of memory should be smallerer than -100, check lifoOnHost (should be greater that -100)" ); |
| // remove these definitions from mach/boolean.h that can conflict with GEOS code (eg. InputFlags::FALSE) | ||
| #undef TRUE | ||
| #undef FALSE |
There was a problem hiding this comment.
Could you instead encapsulate this implementation and all system-specific includes in a separate translation unit (.cpp)? I think LvArray/system.[h/c]pp would be a good place to expose this functionality, if you can spare the effort to open an LvArray PR.
There was a problem hiding this comment.
I'll change that, I tend to avoid commiting to LvArray as it is another project but another translation unit would be cleaner.
| * @brief Retieves current available memory on host | ||
| * @return the available memory in bytes. | ||
| */ | ||
| static inline size_t getAvailableMemory() |
There was a problem hiding this comment.
Maybe indicate in the function name that this is for host/system memory?
|
@herve-gross still needed or close? |
|
This was fixed. We can close it. |
This fixes a compilation error on MacOS where the method to obtain the current memory available on host doesn't not build because _SC_AVPHYS_PAGES is not available.