iOS drawInRect内存泄漏 - ARC

Alb*_*haw 1 memory objective-c ios automatic-ref-counting drawinrect

我在互联网上搜索过,我发现很多人和我有同样的问题而没有解决方案......

如果我有像NSTimer这样的东西并让它反复循环而我将这段代码粘在其中由于某种原因我得到大量的内存泄漏并且应用程序在大约100个左右循环后崩溃.

但我启用了ARC.

drawInRect根据乐器,记忆问题肯定是胜利.

-(void)nstimerTick {

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

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

    testView.image = UIGraphicsGetImageFromCurrentImageContext();

}
Run Code Online (Sandbox Code Playgroud)

Kur*_*vis 6

您没有UIGraphicsEndImageContext()在方法结束时致电.你应该.