1

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

如果我有类似 NSTimer 的东西并且让它一遍又一遍地循环,并且出于某种原因将这段代码粘贴在其中,我会出现大量内存泄漏,并且应用程序在大约 100 次循环后崩溃。

但我启用了 ARC。

drawInRect根据仪器,内存问题绝对是赢家。

-(void)nstimerTick {

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

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

    testView.image = UIGraphicsGetImageFromCurrentImageContext();

}
4

1 回答 1

6

您没有UIGraphicsEndImageContext()在方法结束时调用。你应该。

于 2013-08-17T06:24:23.707 回答