Free memory
From TykWiki
Jump to navigationJump to search
PAGES_FREE=`sysctl -n vm.stats.vm.v_free_count` PAGES_INACTIVE=`sysctl -n vm.stats.vm.v_inactive_count` PAGES_CACHE=`sysctl -n vm.stats.vm.v_cache_count` PAGES_LIBRES=`expr ${PAGES_FREE} + ${PAGES_INACTIVE} + ${PAGES_CACHE}` TAILLE_PAGES=`sysctl -n vm.stats.vm.v_page_size` MEMOIRE_LIBRE=`expr ${PAGES_LIBRES} \* ${TAILLE_PAGES} / 1048576` echo "${MEMOIRE_LIBRE}M free memory"
Thanks to Hubert Tournier in http://lists.freebsd.org/pipermail/freebsd-emulation/2010-August/007935.html