ArchiveOrangemail archive

Discussions regarding native iOS and OS X application developments using Cocoa frameworks


cocoa-dev.lists.apple.com
(List home) (Recent threads) (100 other Apple lists)

Subscription Options

  • RSS or Atom: Read-only subscription using a browser or aggregator. This is the recommended way if you don't need to send messages to the list. You can learn more about feed syndication and clients here.
  • Conventional: All messages are delivered to your mail address, and you can reply. To subscribe, send an email to the list's subscribe address with "subscribe" in the subject line, or visit the list's homepage here.
  • Moderate traffic list: up to 30 messages per day
  • This list contains about 51,735 messages, beginning Oct 2009
  • 0 messages added yesterday
Report the Spam
This button sends a spam report to the moderator. Please use it sparingly. For other removal requests, read this.
Are you sure? yes no

iPad: CGPDF... methods and leak/cache

Ad
sebi 1278523446Wed, 07 Jul 2010 17:24:06 +0000 (UTC)
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
Kyle Sluder 1278524265Wed, 07 Jul 2010 17:37:45 +0000 (UTC)
On Wed, Jul 7, 2010 at 10:21 AM, sebi  wrote:
> 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.I believe this is a known bug, as described in this thread:
http://lists.apple.com/archives/quartz-dev/20...

quartz-dev is a more appropriate list for this thread.

--Kyle Sluder
sebi 1278584124Thu, 08 Jul 2010 10:15:24 +0000 (UTC)
On 07.07.2010, at 19:35, Kyle Sluder wrote:

> On Wed, Jul 7, 2010 at 10:21 AM, sebi  wrote:
>> 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.
> 
> I believe this is a known bug, as described in this thread:
> http://lists.apple.com/archives/quartz-dev/20...
> 
> quartz-dev is a more appropriate list for this thread.
> 
> --Kyle Sluder
>Thanks a lot!

Regards,
Sebastian Mecklenburg_______________________________________________

Cocoa-dev mailing list 

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:
http://lists.apple.com/mailman/options/cocoa-...

This email sent to 
Home | About | Privacy