portable memory usage count

on advice from
https://github.com/tromp/cuckoo/issues/2#issuecomment-41458917