iphone - UIImagePickerController Memory Leak -
i seeing huge memory leak when using uiimagepickercontroller
in iphone app. using standard code apple documents implement control:
uiimagepickercontroller* imagepickercontroller = [[uiimagepickercontroller alloc] init]; imagepickercontroller.delegate = self; if ([uiimagepickercontroller issourcetypeavailable:uiimagepickercontrollersourcetypecamera]) { switch (buttonindex) { case 0: imagepickercontroller.sourcetype = uiimagepickercontrollersourcetypecamera; [self presentmodalviewcontroller:imagepickercontroller animated:yes]; break; case 1: imagepickercontroller.sourcetype = uiimagepickercontrollersourcetypephotolibrary; [self presentmodalviewcontroller:imagepickercontroller animated:yes]; break; default: break; } }
and cancel:
-(void) imagepickercontrollerdidcancel:(uiimagepickercontroller *)picker { [[picker parentviewcontroller] dismissmodalviewcontrolleranimated: yes]; [picker release]; }
the didfinishpickingmediawithinfo callback stanard, although not have pick cause leak.
here see in instruments when open uiimagepickercontroller
, pick photo library, , press cancel, repeatedly. can see memory keeps growing, , causes iphone app slow down tremendously.
as can see opened image picker 24 times, , each time malloc'd 128kb never released. 3mb out of total 6mb never released.
this memory stays leaked no matter do. after navigating away current controller, remains same. have implemented picker control singleton same results.
here see when drill down 2 lines:
any here appreciated! again, not have choose image. present controller, , press cancel.
update 1
i downloaded , ran apple's example of using uiimagepickercontroller
, see same leak happening there when running instruments (both in simulator , on phone).
all have hit photo library button , hit cancel on , over, you'll see memory keep growing.
any ideas?
update 2
i see problem when viewing photo library. can choose take photo, , open , close 1 on , over, without leak.
it's bug in sdk. file report apple. have samme isue. documented here: http://www.cocoabuilder.com/archive/cocoa/285293-iphone-memory-leak-can-explain.html , on year ago , still no fix.
Comments
Post a Comment