ios - Keep incresing memory allocation -
in ios app implemented save videos web. keeps increasing memory usage when downloading videos. have inspect using profile in xcode , saw malloc getting increase per video.
not familiar profile stuff. have released receiveddata nsmutabledata variable.
- (void) connectiondidfinishloading:(nsurlconnection *)connection { nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *documentsdirectry = [paths objectatindex:0]; nslog(@"succeeded! received %d bytes of data",[receiveddata length]); [uiapplication sharedapplication].networkactivityindicatorvisible = no; nsstring *filename = [nsstring stringwithformat:(@"video_%@.mp4"),videourl]; [receiveddata writetofile:[documentsdirectry stringbyappendingpathcomponent:filename ] atomically:yes]; receiveddata = nil; [receiveddata release]; progress.hidden = yes;
}
app getting down performance. how can fix issue.
you have not released receiveddata. have set variable nil before, message sent receiveddata goes nirvana.
also don't forget handle cases when connectiondidfinishloading never called, have release elsewhere because of this.
Comments
Post a Comment