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
Below is the correct answer:
```
float GetTotalPhysicsMemory()
{
struct task_basic_info info;
mach_msg_type_number_t size = sizeof(info);
kern_return_t kr;
kr = task_info(mach_task_self(), TASK_BASIC_INFO, (task_info_t)&info, &size);
if (kr == KERN_SUCCESS)
return (float)(info.resident_size) / 1024.0 / 1024.0;
else
return 0;
}
```