views:

592

answers:

2

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).

A: 

Hello I m also having memory issues, and can't find any solution for 3 weeks now. I m having memory issue and my pdf reader crashes on device. I used CATiledLayer to display pdf (because zooming is perfect with this method). My question is how do you swap between pages and release previous pages without increasing the memory use ??

what I did is :

  • controllerView 1: display page 1
  • controllerView 2: display page 2
  • controllerView 3: display page 3

I don' t know how to recycle objects

Thanks in advance

Hermann
I use a UIScrollView to display the PDF pages along with CATiledLayer as well (although I took a somewhat weird approach of using one huge tile instead of a number of small ones, because otherwise the rendering was really slow). In my experience though, you shouldn't run out of memory as long as you release the actual PDF object after rendering since the only thing that's eating memory after that is the bitmap used to display on screen and at least with UIScrollView those get released automatically if needed. My problem is related to a bug with Apple's code that causes mem usage to go crazy.
Joonas Trussmann
A: 

Where can I find details on Apple's code that causes me usage to go crazy