2011-03-31 44 views
4

我有一个问题。当我使用iPad上的“renderInContext”,使用的内存永远不会释放和累积,直到该应用程序与“Memory警告”级别= 1和Level = 2renderInContext /内存问题

我的代码将关闭:

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); 

我已经尝试了几种方法,但没有空闲的记忆。有任何想法吗?

**对不起,我的英文不好

+0

可能有人帮助我吗? – mhergon 2011-03-31 16:31:47

回答

0

我有同样的问题。经过长时间的调查,似乎内存没有被释放,因为代码没有在主线程上运行。所以,当你不在主线程上工作时,不要执行renderInContext!