Re: Passing Objects In Messages
Re: Passing Objects In Messages
- Subject: Re: Passing Objects In Messages
- From: Scott Anguish <email@hidden>
- Date: Fri, 17 Oct 2003 21:12:23 -0400
On Oct 17, 2003, at 8:58 PM, James Masasaki wrote:
When I pass an object as a parameter in an Objective-C message,
how/when do I know it's safe to dispose of this object? Is it a
requirement that I receive a response before I dispose the object, or
do I just send the message and some garbage collection mechanism
cleans up the object for me?
Thanks,
no, there is no garbage collection... autorelease pools aren't really
garbage collection..
for example, if you pass an object to addObject:, then the object is
retained, and you are free to release it.
usually if a method requires the object/parameter to be kept, it
should retain it.
there are some exceptions (which should be noted in the docs)...
callbacks are one.. and another are passing contexts around which may
or may not been objects...
if you can be more specific about what you're doing, I might be able
to give you a better answer.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.