2
votes

I have a strange issue where I'm scrolling through a paged UIScrollView which displays the pages of a PDF document (using Quartz 2D and CATiledLayer). When I page through memory allocation looks fine with it going up with a few initial pages and then keeping it steady as it obviously releases the memory kept for earlier pages. Upon hitting page x (not a certain PDF page or a certain number per se) memory usage goes from a couple of megs to 308 megs and the app crashes.

So my question is: how to best try to find what's causing this? The object alloc tool in instruments shows the memory as simply going to malloc. (in huge chunks).

1
as a side note, this does not happen in the simulator, only on an actual iPad.Joonas Trussmann
Turned out to be a specific page after all, which is sill odd considering it doesn't crash on the simulator.Joonas Trussmann
It doesn't crash on the simulator, because that one has (practically) unlimited memory and a cpu that is many times faster.steipete
Not quite. The issue can't be detected at all using instruments on the simulator. I have a feeling that the simulator is using some low level CG stuff from OS X rather than iOS (which makes sense considering how the Simulator generally works).Joonas Trussmann

1 Answers

0
votes

This is an old question but I've since figured out the problem so why not post it...

Turns out the culprit was a certain kind of embedded (vector) artwork inside the PDF. This would happen on several different print PDF-s. CGPDF et al just went nuts. The only workaround was to actually rasterize said artwork with the appropriate PDF production tools.