On Sat, May 31, 2008 at 11:14 PM, Brian Christensen <[EMAIL PROTECTED]>
wrote:

> On May 31, 2008, at 16:39, "Stéphane Droux" <[EMAIL PROTECTED]>
>
> > When I run the program in MallocDebug, the memory usage goes up every
> time the timer function is executed. If I change the animation to be on l2
> instead of l1, or if I create l2 as a sublayer of mainLayer, the memory
> usage remains constant. Am I doing something wrong ?
>
>
> An NSTimer is not really the appropriate way to do this. Have a look at
> CABasicAnimation, which you might use in the following manner (untested code
> written on an iPhone, so no guarantees):
>
> CABasicAnimation *anim = [CABasicAnimation animationWithKeyPath:@
> "opacity"];
>
> [anim setFromValue:1.0];
> [anim setToValue:0.2];
> [anim setAutoreverses:YES];
> [anim setDuration:1.0];
>
> [l2 addAnimation:anim forKey:nil];
>
> I would recommend reviewing the Core Animation documentation for additional
> examples.
>
> /brian
>

Actually the animation in my example is only to reproduce the leak. I could
have made it to pick up any random number for opacity (or any other
property), in which case an autoreverse animation wouldn't work, but the
program would still leak.

The problem I have is that when I run several animations on a layer that is
not a leaf, I get a leak.
I tried implicit animations and explicit animations and they both leak.
The timer in my example is only to simulate several animations.

When I run the program in Mallocdebug, it seems that one of the threads used
by Core Animation to animate the layers doesn't release its memory.
So it looks like a bug in Core Animation. However, since animating non-leaf
layers is such a core feature of Core Animation, I guess there's something
missing in my code

Thanks
Stephane
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to