MINIMAL App using a map (apple or google) often killed due to memory pressure (Mainly happens when going to Camera)

Originator:Pich.Dominik
Number:rdar://15750089 Date Originated:05-Jan-2014
Status:Open Resolved:No
Product:IOS SDK Product Version:7
Classification:Performance Reproducible:Always
 
Summary:
my app is only using 15-40mb and is sometimes getting killed.The reason always being vm-pageshortage

Steps to Reproduce:
go from any map view to the camera and take a picture (repeat N times. on devices with a lot of free RAM it takes longer of course)
you will start (quite soon(!) to receive memory warnings
==>BOOM (killed, I can't even make it through 2 iterations right now)

See the MINIMAL demo app I made:
Sample project: only 1 view controller, only 1 map (via Apple MapKit, GMS is equally bad), push camera and take a pic--- BOOM

runnable code: attached

but the gist is:
- (void)loadView {
    UIView *v = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

    CGRect f = v.bounds;
    mapView = [[MKMapView alloc] initWithFrame:CGRectInset(f, 5, 5)];
    [v addSubview:mapView];

    self.view = v;
}

- (void)viewDidAppear:(BOOL)animated {
    [self performSelector:@selector(delayed) withObject:nil afterDelay:3];
}

- (void)delayed {
    UIImagePickerController* imagePickerController = [[UIImagePickerController alloc] init];
    imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
    imagePickerController.delegate = (id)self;
    imagePickerController.showsCameraControls = NO;
    [self presentViewController:imagePickerController animated:YES completion:nil];

    [imagePickerController performSelector:@selector(takePicture) withObject:nil afterDelay:2];
}

- (void)imagePickerController:(UIImagePickerController *)imagePicker didFinishPickingMediaWithInfo:(NSDictionary *)info {
    UIImage* image = [info objectForKey:UIImagePickerControllerOriginalImage];
    NSData *jpg = UIImageJPEGRepresentation(image, 0.8);
    NSLog(@"jpg %d", ((const char*)jpg.bytes)[0]);
    [self dismissViewControllerAnimated:YES completion:nil];
}

Expected Results:
don't 'crash' ;)

Actual Results:
The App is Always killed. Sometimes sooner, sometimes later

Version:
IOS 7.0.4

Notes:


Configuration:
iPhone 4S 
language: en
country: DE

runnable sample:
https://dl.dropboxusercontent.com/u/3753090/MapKitTest.zip

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!