ios - CGImageRef uses lot of memory even after release -



ios - CGImageRef uses lot of memory even after release -

i'm using cgimageref , noticed uses lot of memory doesn't deallocated. tried experimenting next code

- (void)photofromasset:(alasset *)asset completion:(void(^)(nserror *error))completionhandler alassetrepresentation *representation = asset.defaultrepresentation; uiimageorientation orientation = (uiimageorientation)representation.orientation; cgimageref fullresolutionimage = representation.fullresolutionimage; //uiimage *fullimage = [uiimage imagewithcgimage:fullresolutionimage scale:0.0 orientation:orientation]; //[self startupload:fullimage completion:completionhandler]; }

put breakpoints , set first 3 lines of code in @autorelease pool. tried removing @autorelease , called

cgimagerelease(fullresolutionimage);

when uiimageorientation app using less 30mb phone call cgimageref gets more 80mb. both memory freeing methods me 50mb, there's 20mb somewhere. 20mb freed when whole method gets completed.

where 20mb from? how can free them before calling startupload: ?

thank you

you don't need release manually cgimageref, old cf opaque type follows rules of ownership, need care memory management if in function/method name there create or copy. problem hard understand -startupload , phone call -photofromasset. suggestion if -photofromasset called within loop, wrap what's within loop in @autorelasepool. sec startupload (i imagine uploading server) continues maintain strong reference image decompressing , sending server. avoid avoid opening lot of connection suggestion create sort of queue network operations , send 2 images "at once".

ios memory nsautoreleasepool cgimageref

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -