Re: Scroller With CATiledLayer Running out of Memory
Re: Scroller With CATiledLayer Running out of Memory
- Subject: Re: Scroller With CATiledLayer Running out of Memory
- From: Gordon Apple <email@hidden>
- Date: Fri, 06 Aug 2010 16:09:31 -0500
- Thread-topic: Scroller With CATiledLayer Running out of Memory
I chose 1024 width so that it would at least cover the (landscape) width,
and not have to redraw the same line multiple times. The optimized drawing
requires some computation itself, so I figured 512 was a good compromise
that would require three tiles max per screen. Font size can go up to 192
pt and the view length (constrained in width) goes up with the square of the
font size, so it can get quite lengthy. A ten minute speech is one thing, a
12-hr Fidel Castro speech-a-thon is something else.
BTW, the reason I went to a tiled layer in the first place is that CALayer
crapped out long before that and only allowed a fairly short document view
length.
I thought maybe the fadeDuration might be causing it to hold onto far too
many tiles for too long a time when fast scrolling, rather than just dumping
them after it blew past. I can try 256 x 1024 and see if it helps, although
I'm skeptical. Even if it helps, I would still like to be able to render
far longer documents and I fear I'm going to run into the same problem when
somebody fast scrolls.
On 8/6/10 3:23 PM, "David Duncan" <email@hidden> wrote:
> On Aug 6, 2010, at 12:29 PM, Gordon Apple wrote:
>
>> I'm having a major problem. If I scroll slowly, or in small jumps, no
>> problem. However, if I scroll fast over a longer length, the app terminates
>> with memory exceeded. I don't believe I have any significant leaks. This
>> doesn't happen in the simulator, only on the iPad. Am I simply outrunning
>> the app's ability to recover memory? What gives?
>>
>> I notice that default fadeDuration for CATiledLayer is 0.25 sec. However, I
>> see no way to set this (i.e., to 0.0). Could this be related to my problem?
>> Any workarounds?
>
>
> I don't think the fade duration is related, but it is possible that you are
> out running the buffer reclamation that Core Animation performs. 1024x512
> tiles are about 2MB a piece, and if you manage to trigger a large number of
> them to vend to draw especially if each of them takes a while to draw, which
> is a function of their size then you could end up blowing past available
> memory pretty quickly.
>
> You might try using smaller tiles instead. Fade duration is unlikely to have
> any effect (as that is applied after a tile is rendered).
> --
> David Duncan
>
_______________________________________________
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