I am specifically talking about physical RAM, I do not want virtual memory stats to be included. I am on Mac OSX Snow leopard but would prefer a solution that would work on ALL OS X platforms (i.e. Lion). I am using Objective-C but solutions in C would also obviously be valid.
Share
It sounds like what you want to be able to report is the same stuff that the command line utility vm_stat displays? If so then it’s probably easiest just to check out its source code, which is amongst the stuff Apple provide as open source.
The relevant code is at the bottom; it all falls back on a call to
host_statistics64, which appears to be defined viamach/mach.h. A quick search of my machine shows it also to be available (or, at least, defined) in iOS.