Re: Help reading cocoa docs - finding info about return objects and autorelease / memory management.
Re: Help reading cocoa docs - finding info about return objects and autorelease / memory management.
- Subject: Re: Help reading cocoa docs - finding info about return objects and autorelease / memory management.
- From: Wyatt Webb <email@hidden>
- Date: Thu, 11 Dec 2008 16:28:26 -0800
Have a look at the Memory Management Programming Guide for Cocoa.
Especially the section on Object Ownership and Disposal. The trick is
in the name of the methods you call to get the reference. Generally,
methods with "alloc", "new", or "copy" in the name are making you
responsible for releasing. Others do not and you would need to retain
if you expect to hang on to them for a while.
http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Concepts/ObjectOwnership.html#/
/apple_ref/doc/uid/20000043-BEHDEDDB
Wyatt
On Dec 11, 2008, at 4:13 PM, aaron smith wrote:
Hey All,
Quick question, what is the best way to determine what kind of cleanup
I need to do with objects that were returned from other objects'
methods, or class methods.
For example, the NSTextField has a method called (NSString
*)stringValue - which returns a string of the value in the text box.
how do I know if that NSString will have a retain count of 1 when
returned to me, or if it was autoreleased before being returned to me.
Beyond just that example, is there any other cheat sheets, or more
documentation in the cocoa docs about those types of concerns?
Thanks.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden