On iOS 8.1, I get a memory leak when rendering a PDF page in a graphical context with CGContextDrawPDFPage. This does not happen in the simulator, but every time I do this, I get hundreds of leaks from 272 bytes of malloc'd memory (on iPad Air). If I comment on CGContextDrawPDFPage, the leak will disappear.
Does anyone have this kind of behavior?
CGDataProviderRef dataProvider = CGDataProviderCreateWithCFData((CFDataRef)data);
CGPDFDocumentRef pdf = CGPDFDocumentCreateWithProvider(dataProvider);
CGPDFPageRef page;
page = CGPDFDocumentGetPage(pdf, pageNo + 1);
UIGraphicsBeginImageContext(aRect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextTranslateCTM(context, 0, aRect.size.height);
CGContextScaleCTM(context, 1, -1);
CGContextDrawPDFPage(context, page);
UIGraphicsEndImageContext();
CGPDFDocumentRelease(pdf);
CGDataProviderRelease(dataProvider);
Here's the stack trace (reverse):
taNos
38.58 MB 36.7% 148743 std :: __ 1 :: list> :: list (std :: __ 1 :: list> const &)
19.61 MB 18.6% 75610 std :: __ 1 :: vector CG :: Path :: Subpath CG :: Allocator
19.61 MB 18.6% 75610 void std :: __ 1 :: vector> :: __ push_back_slow_path (CG :: Path :: Subpath & &)
19.61 MB 18.6% 75610 CG :: Path :: Sequence :: move_to_point (CGPoint const &, CGAffineTransform const *)
19.61 MB 18.6% 75610 CGPathMoveToPoint
19.59 MB 18.6% 75506 TTrueTypeQuadOutlineContext:: AddPoint (bool, int, int)
19.59 MB 18.6% 75506 TTrueTypeFontHandler:: RenderGlyph (unsigned short, TTrueTypeQuadOutlineContext &, unsigned int) const
19.59 MB 18.6% 75506 TTrueTypeFontHandler:: GetOutlinePath (unsigned short, TGlyphOutlineBatch const &) const
19.59 MB 18.6% 75506 FPFontCopyGlyphPath
19.59 MB 18.6% 75506 CGFontCreateGlyphPath
19.59 MB 18.6% 75506 CGFontCreateGlyphBitmap
19.59 MB 18.6% 75506 CGGlyphBuilder:: create_missing_bitmaps (CGGlyphIdentifier const *, unsigned long, CGGlyphBitmap const **)
19.59 MB 18.6% 75506 render_glyphs
19.59 MB 18.6% 75506 draw_glyph_bitmaps
19.59 MB 18.6% 75506 ripc_DrawGlyphs
19.59 MB 18.6% 75506 draw_glyphs
19.57 MB 18.6% 75434 draw_glyphs
19.55 MB 18.6% 75359 simple_draw
19.55 MB 18.6% 75359 CGPDFTextLayoutDrawGlyphs
19.55 MB 18.6% 75348 op_TJ
19.55 MB 18.6% 75348 pdf_scanner_handle_xname
19.55 MB 18.6% 75348 CGPDFScannerScan
19.55 MB 18.6% 75348 CGPDFDrawingContextDrawPage
19.55 MB 18.6% 75348 pdf_page_draw_in_context
19.55 MB 18.6% 75348 CGContextDrawPDFPage