There is no _AVPHYS_PAGES on FreeBSD
Compilation of GEGL currently fails on FreeBSD.
CC gegl-config.lo
/home/lantw44/gnome/source/gegl/gegl/gegl-config.c:283:30: error: use of undeclared identifier '_SC_AVPHYS_PAGES'
mem_available = sysconf (_SC_AVPHYS_PAGES) * sysconf (_SC_PAGESIZE);
^
1 error generated.
Both _SC_PHYS_PAGES
and _SC_AVPHYS_PAGES
are marked as non-standard in Linux man pages. On FreeBSD, _SC_PHYS_PAGES
is implemented, but _SC_AVPHYS_PAGES
isn't. I tried to understand what this section of code is intended to do by calling sysconf on Linux. I found that the value of _SC_AVPHYS_PAGES
was largely affected by the amount of memory used to cache disk data. That is, reading a large file from a disk could greatly reduce _SC_AVPHYS_PAGES
, making it unlikely to be a number meaningful to applications.
$ getconf _PHYS_PAGES
2027264
$ getconf _AVPHYS_PAGES
1749703
$ find ~/.thunderbird -type f -exec cat '{}' + >/dev/null
$ getconf _PHYS_PAGES
2027264
$ getconf _AVPHYS_PAGES
31060
The size of my Thunderbird folder is 11 GiB, so reading it can use up all free memory on this laptop.