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.

enter image description here

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:

enter image description here

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).

http://developer.apple.com/library/ios/#samplecode/photopicker/introduction/intro.html%23//apple_ref/doc/uid/dts40010196

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

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -