I\'m trying to retrieve the amount of memory my iPhone app is using at anytime, programmatically. Yes I\'m aware about ObjectAlloc/Leaks. I\'m not interested in those, only
Objective-C version:
size_t memoryFootprint()
{
task_vm_info_data_t vmInfo;
mach_msg_type_number_t count = TASK_VM_INFO_COUNT;
kern_return_t result = task_info(mach_task_self(), TASK_VM_INFO, (task_info_t) &vmInfo, &count);
if (result != KERN_SUCCESS)
return 0;
return static_cast(vmInfo.phys_footprint);
}