Skip to content

Instantly share code, notes, and snippets.

@densa
Created August 22, 2011 08:04
Show Gist options
  • Save densa/1161894 to your computer and use it in GitHub Desktop.
Save densa/1161894 to your computer and use it in GitHub Desktop.
iphone memory usage
#import mach/mach.h
void report_memory(void) {
struct task_basic_info info;
mach_msg_type_number_t size = sizeof(info);
kern_return_t kerr = task_info(mach_task_self(),
TASK_BASIC_INFO,
(task_info_t)&info,
&size);
if( kerr == KERN_SUCCESS ) {
NSLog(@"Memory used: %u", info.resident_size); //in bytes
} else {
NSLog(@"Error: %s", mach_error_string(kerr));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment