문제

I've searched all over the internet and I have found alot of people with the same issue as me and no solution...

If I have something like an NSTimer and have it loop over and over and I stick this code in it for some reason I get massive memory leaks and the app crashes after about 100 or so loops.

But I have ARC enabled.

The memory issue is definitely win drawInRect according to instruments.

-(void)nstimerTick {

    UIGraphicsBeginImageContextWithOptions(testView.frame.size, NO, 0.0);

    [[testView image] drawInRect:testView.bounds];

    testView.image = UIGraphicsGetImageFromCurrentImageContext();

}
도움이 되었습니까?

해결책

You aren't calling UIGraphicsEndImageContext() at the end of your method. You should.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top