views:

40

answers:

1

Instead of using instrumentation, is there a way to get current consumption? I want to periodically log the memory consumption (or how much free memory I got).

A: 
#include <mach/task.h>
#include <mach/task_info.h>

task_basic_info basic;
mach_msg_type_number_t count = TASK_BASIC_INFO_COUNT;
task_info( mach_task_self() , TASK_BASIC_INFO , (task_info_t)&basic , &count );

I have not tried this on an iPhone. There may be permission issues when running in a sandbox.

drawnonward
thanks that worked.
BuggerMe