On Tue, May 5, 2009 at 12:45 AM, Graham Cox <graham....@bigpond.com> wrote: > If I retain the object before returning it in -awakeAfterUsingCoder:, the > problem goes away, but this appears to violate normal memory management > rules, so it's not clear that this is the correct solution. The > documentation doesn't explicitly say anything about this either.
Actually it fits them just fine, when you look at the rules like this: - Within any pair of {}, the number of calls to alloc, copy, and retain must match the number of calls to release and autorelease. Generally there's an exception for init/dealloc methods, but if you use accessor religiously then you don't even need that exception. Following this rule (which is not from Apple's docs, but comes from http://www.stepwise.com/Articles/Technical/2001-03-11.01.html), you balance the release with a retain (or alloc or copy). Mike _______________________________________________ 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