On May 18, 2010, at 1:20 PM, Sai wrote:
> Anyway, why I should retain that?

 Because otherwise it will get autoreleased, but your instance variable will 
still contain its address, and the next time you try to use it via the instance 
variable, you will try to talk with random memory at that address, which is a 
Bad Idea(tm). It may still look like the object that was last there, it may 
look like a completely different object, or it may have been overwritten by 
someone in the meantime.

> Will it be released by "somebody"?

 Hopefully by your dealloc method.

 This behaviour would only be different if you were using the garbage collector.

 If all of this is new to you, you should really try to get a good book about 
the basics of Cocoa objects and memory management.

-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."



_______________________________________________

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