Reputation: 24760
Is there a way to see how much ram your app is using during runtime? You could then conditionally choose whether to allow the user to load more assets. For example, an app that lets you put together a photo collage, depending on the size of the imported photos, your total allowed quantity of photos might be different from project to project.
Upvotes: 0
Views: 171
Reputation: 7461
Use following function that will give you memory usage at runtime. You can call this function before and after some allocation in your code. So it will give you memory usage of some allocation and you can know where the memory is increasing.
void memory_report(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 in use (in bytes): %u", info.resident_size);
} else {
NSLog(@"Error with task_info(): %s", mach_error_string(kerr));
}
}
Hope, this will help you..
Upvotes: 1