2

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).

BuggerMe
  • 127
  • 7
  • 1
    Duplicate: http://stackoverflow.com/questions/787160/programmatically-retrieve-memory-usage-on-iphone – AndersK Jun 24 '10 at 01:12

1 Answers1

2
#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
  • 53,459
  • 16
  • 107
  • 112