渲染pdf页面时内存泄漏

时间:2012-02-03 13:41:24

标签: objective-c ios memory-leaks ios5

您好我正在努力寻找内存泄漏。我和卡在一个:) 我用这种方法得到了内存泄漏:

- (void)drawLayer:(CATiledLayer *)layer inContext:(CGContextRef)context
{
#ifdef DEBUGX
    NSLog(@"%s", __FUNCTION__);
#endif

    CGPDFPageRef drawPDFPageRef = NULL;

    CGPDFDocumentRef drawPDFDocRef = NULL;

    @synchronized(self) // Block any other threads
    {
        drawPDFDocRef = CGPDFDocumentRetain(_PDFDocRef);

        drawPDFPageRef = CGPDFPageRetain(_PDFPageRef);
    }

    CGContextSetRGBFillColor(context, 1.0f, 1.0f, 1.0f, 1.0f); // White

    CGContextFillRect(context, CGContextGetClipBoundingBox(context)); // Fill

    if (drawPDFPageRef != NULL) // Go ahead and render the PDF page into the context
    {
        CGContextTranslateCTM(context, 0.0f, self.bounds.size.height); CGContextScaleCTM(context, 1.0f, -1.0f);

        CGContextConcatCTM(context, CGPDFPageGetDrawingTransform(drawPDFPageRef, kCGPDFCropBox, self.bounds, 0, true));

        CGContextSetRenderingIntent(context, kCGRenderingIntentDefault); CGContextSetInterpolationQuality(context, kCGInterpolationDefault);

        CGContextDrawPDFPage(context, drawPDFPageRef); // 100 %
    }

    CGPDFPageRelease(drawPDFPageRef); CGPDFDocumentRelease(drawPDFDocRef); 
}

我无法弄清楚出了什么问题?也许有人可以帮我这个?

编辑: 泄漏:

Leaked Object   #   Address Size    Responsible Library Responsible Frame
Malloc 8 Bytes,1    0x46b608    8 Bytes CoreGraphics    mem_alloc

0 个答案:

没有答案