On Apr 9, 2009, at 6:00 PM, Miles wrote:

I have created a static method creating and returning an animation that I use in various places in my application. I think this may be causing a leak. If I autorelease theAnimation in the return statement I get a crash because
I the animation must be being release before it's complete.

Right, because "theAnimation" is *already* autoreleased. The method "animationWithKeyPath" does not contain "new", "alloc", or "copy", therefore you do not own the object, and therefore you are not responsible for (auto)releasing it.

Is this indeed causing a leak?

No.

Might I suggest you review <http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmObjectOwnership.html#//apple_ref/doc/uid/20000043 >.

_______________________________________________

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 arch...@mail-archive.com

Reply via email to