开发者

Severe memory problems with UIImagePickerController using Camera

I've noticed that when I load a UIImagePickerController and I take a picture with it, didReceiveMemoryWarning is called. Also, in Instruments, there is a significant memory leak (not by me, I swear!). I've heard that this is a problem with UIImagePickerController but, I'm not sure how to fix it. Here is my implementation of UIImagePickerController.

    UIImagePickerController *开发者_如何学CimagePicker = [[UIImagePickerController alloc] init]; // Create the imagePicker
    imagePicker.delegate = self; 
    imagePicker.allowsEditing = YES; // Allow editing of the images
    imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
    [self presentModalViewController:imagePicker animated:YES];
    [imagePicker release];

Any ideas? I really don't want to sacrifice such a useful feature.


Do you have the same leak with the SDK 3.2?
I had a similar leak when using the UIImagePickerController to take a video.

When I found that the leak was fixed in 3.2, I decided to set the minimum OS version of my application to 3.2.

About the memory warning, it's to be expected. The camera needs a lot of memory to do its job, and is simply requesting as much memory as possible from your app by sending a didReceiveMemoryWarning message.


You need to rescale the image to a smaller size, say 320x460. Then it will run successfully.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜