I have recently ran into a problem where my MapView appears to be using more memory than it should. I have disabled all my methods that are populating the annotations and downloading data etc and leaving the app just to the map view essentially. The map view is initialized and allocation in a singleton object called Map Manager that I use through the map because I use the map in multiple views. All the map handling methods reside in this object as well. When running my app, zooming, sculling, panning etc is very choppy and sluggish. I am running the newest iPad Mini.
When running the app on iOS7, within xCode the the memory utilization reports spikes at ~ 180MB of memory. If I run the app, then open Apple Maps at the same time and play around with it, I have caused my app to crash due to error: Terminated due to Memory Pressure.
Below is my map initializer and instruments profile while running the Allocations test:
+ (id)sharedInstance
{
static LBMapManager *mapManager = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
// Intialize the class
mapManager = [[self alloc] init];
// Intialize map
mapManager.mapView = [[MKMapView alloc] init];
mapManager.mapView.mapType = [[LBSettings getObjectForKey:kLBSettingsMapType] intValue];
mapManager.mapView.showsBuildings = YES;
mapManager.mapView.showsPointsOfInterest = YES;
mapManager.mapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
});
return mapManager;
}
Photo: