How to get accuracy memory usage on iphone device.

Posted by Favo Yang on Stack Overflow See other posts from Stack Overflow or by Favo Yang
Published on 2010-03-21T12:16:28Z Indexed on 2010/03/21 12:21 UTC
Read the original article Hit count: 315

Filed under:
|

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?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about memory-usage