CoreAnimation Memory Use/Eating Memory
CoreAnimation Memory Use/Eating Memory
- Subject: CoreAnimation Memory Use/Eating Memory
- From: Colin Cornaby <email@hidden>
- Date: Sat, 22 Mar 2008 18:02:14 -0700
I have a document based app that loads layers of certain sizes in a
document based on user input. As I've been optimizing my app, I
noticed that loading a 5000x5000 image into a layer causes my
application to consume 200 more MB of memory. Seems a little high, but
fair enough. But more interestingly, I noticed that according to
Activity Monitor, after the document is closed, the memory is not
freed. When the document is closed, my application tears down the
entire layer tree and dealloc's all layers, all my backing contexts
and CGLayers, and yet the memory still lives on.
I've tried tracking where this memory is coming from, but Instruments
won't even see this extra memory being allocated. When I load the
5000x5000 image into my CALayer's contents, Instruments does not see
any change in my memory usage, while Activity Monitor sees the 200 MB
extra being allocated. Instruments also does not find any leaks in my
program.
Creating a new document with the 5000x5000 image in a layer in my app
doesn't seem to reuse the memory, it just adds another 200 MB.
At first I thought this is unique to my program, but I did some
testing, and Pixelmator exhibits the same behavior (I tested
Pixelmator because it is also a heavily GL accelerated program). If I
create a new 5000x5000 document, it allocates around another 100 megs
of memory, and doesn't release it after the document is closed. I can
create document after document and watch the memory pile up. This
could be coincidence, and it's possible the Pixelmator crew shipped
their app with some sort of leak, but it's very similar behavior.
Is CoreAnimation doing some sort of bizarre GL related caching? If so,
is there some sort of way I can manage it? When rendering multiple
large images in CoreAnimation, the memory really starts to pile up and
actually can run my process entirely out of memory in extreme cases,
despite me deallocing unneeded layers (because whatever they are
caching stays in memory).
I apologize in advance if this is some newb thing. I was up late last
night trying to track down this issue, and it's been a long week for
me. I'm not really running on all cylinders right now...
Thanks,
Colin
_______________________________________________
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