my image picker is initialized like:
self.imgPicker = [[UIImagePickerController alloc] init];
self.imgPicker.allowsEditing = YES;
self.imgPicker.delegate = self;
self.imgPicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
presentation:
[self initImagePickerFromLibrary]; —-(this calls the lines I have mentioned before)
[self presentModalViewController:self.imgPicker animated:YES]; [imgPicker release];
apple instrument says:
before calling the picker memory used is 3 Mb.While the picker is in function 12Mb.While editing image is 28Mb and my app crashes.Anyone did find a solution for this?
The one thing that comes to mind is that you’re doing
self.which may mean that your image picker is retained twice. Once, because you’re allocating it and once because you’re using a setter.What does the
@propertyline look like forimgPicker? Does it haveretain? If it does, you should either change the first line in your first quote above to:I.e. removing
self..Also in your second line, you’re releasing
imgPickerdirectly. If your@propertydoes have retain, you should instead just do:The reason is that the
@propertysynthesizing retains and releases objects when you set them. If youreleasetheimgPickerwithout setting it tonil, and then, later on, try to set it to a new value, the system will attempt toreleasethe already released object, and probably crash. The above is the same as doing: