• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
iPad: CGPDF... methods and leak/cache
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

iPad: CGPDF... methods and leak/cache


  • Subject: iPad: CGPDF... methods and leak/cache
  • From: sebi <email@hidden>
  • Date: Wed, 7 Jul 2010 19:21:59 +0200

Hello,

I'm writing an app on iPad that lets the user navigate through a >700 page pdf. When he's on some page I preload the next and previous pages as UIImage (using CGContextDrawPDFPage()) so navigation is faster. Everything is fine at first, but after a few tens of pages the memory gets full and I can preload fewer and fewer images until I can't even create the UIImage for the current page.
When I get a memory warning I unload most of the images and I also release the current CGPDFDocumentRef which should release the memory.
Unfortunately it doesn't. ObjectAlloc shows me that I have thousands of small memory blocks hanging around between 8 bytes and 32 kilobytes that somehow were created in the CGPDF... methods.

For example, the 96 byte blocks are from here:
  18 CoreGraphics CGContextDrawPDFPage
  17 CoreGraphics CGPDFDrawingContextDraw
  16 CoreGraphics CGPDFScannerScan
  15 CoreGraphics read_objects
  14 CoreGraphics handle_xname
  13 CoreGraphics op_TJ
  12 CoreGraphics CGPDFDrawingContextDrawText
  11 CoreGraphics CGPDFTextLayoutDraw
  10 CoreGraphics draw_glyphs
   9 CoreGraphics draw_glyphs
   8 libRIP.A.dylib ripc_DrawGlyphs
   7 libRIP.A.dylib ripc_RenderGlyphs
   6 CoreGraphics CGGlyphLockLockGlyphBitmaps
   5 CoreGraphics create_missing_bitmaps
   4 CoreGraphics CGFontCreateGlyphBitmaps
   3 CoreGraphics CGFontCreateGlyphBitmaps8
   2 CoreGraphics CGFontGetGlyphPaths
   1 CoreGraphics glyph_path_end8
   0 CoreGraphics CGGlyphBitmapCreate

and there are over 3000 of them alive! More than 600 1kb blocks are from CGPDFDictionaryCreateWithObjects (called by CGPDFDocumentGetPage) and CGFontCacheSetValue (CGContextDrawPDFPage). And so on.

The customer is very unhappy and I'm too. What can I do? Are these leaks? Or does CoreGraphics build up some cache which I can release or so? Right now the only object I actually create is a CGPDFDocumentRef which I  inside the didReceiveMemoryWarning method and recreate later on the next page request. Apart from that I only use CGPDFDocumentGet... methods which shouldn't return anything for me to release, right?

My basic assumption is, thet all these objects lead to some massive memory fragmentation so the systm can't alloc enough large chunks of memory for images. Is this reasonable? I assume this, because the total numer of memory used by my app always stays below 30 mb (as shown by ObjectAlloc's "Live Bytes") column.

Thanks and regards,
Sebastian Mecklenburg

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: iPad: CGPDF... methods and leak/cache
      • From: Kyle Sluder <email@hidden>
  • Prev by Date: Building a Spotlight-like custom NSMenu with an embedded NSSearchField
  • Next by Date: Re: Pass-by value? warning (was: NSTextField fieldeditor subclass example? (and an unrelated other inquiry))
  • Previous by thread: Building a Spotlight-like custom NSMenu with an embedded NSSearchField
  • Next by thread: Re: iPad: CGPDF... methods and leak/cache
  • Index(es):
    • Date
    • Thread