Memory leak issue with UIImagePickerController

Posted by Mustafa on Stack Overflow See other posts from Stack Overflow or by Mustafa
Published on 2009-01-28T10:37:12Z Indexed on 2010/05/10 3:28 UTC
Read the original article Hit count: 640

I'm getting memory leak with UIImagePickerController class.

Here's how I'm using it:

	UIImagePickerController *picker = [[UIImagePickerController alloc] init];
	picker.delegate = self;
	picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
	[self presentModalViewController:picker animated:YES];
	[picker release];

To remove the picker i call [picker dismissModalViewControllerAnimated:YES]; in didFinishPickingImage and imagePickerControllerDidCancel.

--

Instruments show around 160bytes leaking as a result of this instruction:

+[UIImagePickerController _loadPhotoLibraryIfNecessary]

Apparently this issue has and is disturbing many people, and solution to avoid this problem is to build a singleton class dedicated for picking images from library or capturing using device's build in camera.

Anyone want to add something?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about image