0

I've been testing my app and currently at peak points it consumes more than 450 mb of ram. The number is astoundingly big due to AppleMaps api. Simple zoom out eats around 150 mb of ram.

After browsing i've found out a tricky solution - which is reversing the Map types for a second (from standard to satellite to standard). The following snippet code helps me achieve that:

[mapView setMapType:MKMapTypeSatellite];
[mapView setMapType:MKMapTypeStandard];

The issue is - i want to apply a rule - if my app is using equal or more than 400 mb of ram - this trick should be performed. And so far i have no clue how to do that.

NB: Tried following the article "How to programmatically retrieve the RAM memory" advised by the admin, but couldnt get the code to work.

Any ideas greatly appreciated.

Thank you!

David Robertson
  • 1,561
  • 4
  • 19
  • 41
  • Tried using the code 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 in use (in bytes): %u", info.resident_size); } else { NSLog(@"Error with task_info(): %s", mach_error_string(kerr)); } } but if i put my strings [mapView .. ] instead of NSLog - i receive an error – David Robertson Jun 08 '15 at 13:49
  • Why not just _always_ use your trick? e.g. after zooming – matt Jun 08 '15 at 15:42
  • did that - helps somewhat) but the screen is blinking now upon every button press. thanks anyway – David Robertson Jun 09 '15 at 13:45

0 Answers0