How to get accuracy memory usage on iphone device.
- by Favo Yang
I want to output accuracy memory usage on iphone device, the method I used was taking from,
http://landonf.bikemonkey.org/code/iphone/Determining%5FAvailable%5FMemory.20081203.html
natural_t mem_used = (vm_stat.active_count +
vm_stat.inactive_count +
vm_stat.wire_count) * pagesize;
natural_t mem_free = vm_stat.free_count * pagesize;
natural_t mem_total = mem_used + mem_free;
The issue is that the total value is always changed after testing on device!
used: 60200.0KB free: 2740.0KB total: 62940.0KB
used: 53156.0KB free: 2524.0KB total: 55680.0KB
used: 52500.0KB free: 2544.0KB total: 55044.0KB
Have a look for the function implementation, it already sum active, inactive, wire and free pages, is there anything I missing here?