Memory 渲染上下文/内存问题
我有个问题。当我在iPad中使用“renderInContext”时,所使用的内存永远不会释放并积累,直到应用程序关闭时,级别为1和2的“内存警告”才会释放和积累 我的代码:Memory 渲染上下文/内存问题,memory,memory-management,Memory,Memory Management,我有个问题。当我在iPad中使用“renderInContext”时,所使用的内存永远不会释放并积累,直到应用程序关闭时,级别为1和2的“内存警告”才会释放和积累 我的代码: CGRect mediaBox = CGRectMake(0, 0, 16.54 * 72.0, 24.02 * 72.0); CGContextRef ctx = CGPDFContextCreateWithURL((CFURLRef)[NSURL fileURLWithPath:posterPa
CGRect mediaBox = CGRectMake(0, 0, 16.54 * 72.0, 24.02 * 72.0);
CGContextRef ctx = CGPDFContextCreateWithURL((CFURLRef)[NSURL fileURLWithPath:posterPath isDirectory:NO], &mediaBox, NULL);
CGPDFContextBeginPage(ctx, NULL);
CGContextScaleCTM(ctx, 0.516, -0.516);
CGContextTranslateCTM(ctx, 0, -mediaBox.size.height - 1500);
[[self returnBigView].layer renderInContext:ctx];
CGPDFContextEndPage(ctx);
CGPDFContextClose(ctx);
CGContextRelease(ctx);
我试过几种方法,但没有可用的内存。有什么想法吗
**对不起,我的英语不好我也有同样的问题。经过长时间的调查,内存似乎没有释放,因为代码没有在主线程上运行。因此,当您不在主线程上工作时,不要执行renderInContext 我也遇到了同样的问题,在一个循环中-将图层内容设置为nil对我来说很有效: