> Any initialiser with a "+" in front of it returns an autoreleased object
ACK! NO! A *method* with a "+" is a "class method", whether it returns an autoreleased object or nothing at all. Class methods that return autoreleased objects are for convenience, but not all of them do. Consider +(void)initialize ... also, *none* of them are "initializers" by implication because they're class methods. > - hence you MUST retain them or else they are simply released > when the autorelease pool they are created in is released - which you can > treat as occurring at the end of the method in which the init occurs. In the case of any autoreleased object, yes, if you want it to stick around, you need to retain it. Whether a method returns an autoreleased object or not is documented in the API reference (for that method). More importantly, though, it's dangerous (for the purposes of understanding odd memory-management-related crashers and where / how you should look for the cause) to "treat [the autorelease] as occurring at the end of the method in which the init occurs". It has nothing to do with the scope of the method, but everything to do with the current run loop versus the run loop in which the autorelease pool is popped (resulting in the release of all objects in the pool). The "run loop in which the autorelease pool is popped" may even be the current one ... it may even be *before* your init method is finished if you created the pool and kill it before returning. Of course if you did that, you'd probably know what to expect, but still ... This is all well-documented, and re-defining this is against the list guidelines (because it's often misrepresented -- in fact I may not be entirely accurate here, either), so I'll say no more than that. Please, when there are conversations that require explaining memory management, just refer the OP to the memory management documentation: http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Tasks/MemoryManagementRules.html -- I.S. _______________________________________________ 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]