ios - Memory Warning Crash using ARC -
this question has answer here:
i using arc , app crashes saying received memory warning. have used apple instruments , got
5
it looks not have leaks cannot find wrong. crash has memory , due arc cannot use release , sort. first time dealing memory usage using arc. there away can debug since dealing 2 months. have code on git hub helpful if @ it. can find here.
i confused may because need set uiimage
instant user capture image nil
each time. looks creating instance again without dealloc old image. how able clear stuff. need help. thanks.
the solution adding @autoreleasepool {}
statements code. if have loop allocating lot of memory, memory may not freed until application gets main run loop.
you want change loops iterate many times this:
for (id value in largearray) { @autoreleasepool { //code creates autoreleased objects } }
in above code block, each time loop finishes, autoreleased objects created inside pool released , memory freed use.
some more info can found in this question
Comments
Post a Comment