Alternative to sysconf(_SC_AVPHYS_PAGES) to get available memory?

Hi all,

I'm just trying to compile osm2rdf (osm map data to GeoSPARQL), and found that
they use sysconf(_SC_AVPHYS_PAGES) to get available memory:

C++:
int64_t available() {
 return sysconf(_SC_AVPHYS_PAGES) * sysconf(_SC_PAGE_SIZE);
}

Looking at sysconf(3) I can see that we do not have _SC_AVPHYS_PAGES. I searched
for alternatives, but did not find any. I also did not find anything like
"available" memory in sysconf(3).

So, can anyone tell me a FreeBSD alternative to sysconf(_SC_AVPHYS_PAGES)?

Thanks,

Mathias
 
I usually replace such mechanisms with an environment variable.

It is a really bad idea to question the system for memory at some point in time not knowing what additional memory demand will come along from other software.
 
Back
Top