2011-03-31 42 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!