Actually, GU_AVPHYS_SIZE may not be ideal here.
a) It doesn't take into account fs cache.
b) On PAE systems, applications can address more than 4G. However, size_t on those systems is still 32 bit I presume and will still overflow.
http://compgroups.net/comp.unix.programmer/available-physical-memory/536419 has discussion relating to it.
There is get_avphys_pages , however, it is linux only.
Actually, GU_AVPHYS_SIZE may not be ideal here.
a) It doesn't take into account fs cache.
b) On PAE systems, applications can address more than 4G. However, size_t on those systems is still 32 bit I presume and will still overflow.
http:// compgroups. net/comp. unix.programmer /available- physical- memory/ 536419 has discussion relating to it.
There is get_avphys_pages , however, it is linux only.