• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Passing Objects In Messages
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.
References: 
 >Passing Objects In Messages (From: James Masasaki <email@hidden>)

  • Prev by Date: Passing Objects In Messages
  • Next by Date: Re: Passing Objects In Messages
  • Previous by thread: Passing Objects In Messages
  • Next by thread: Re: Passing Objects In Messages
  • Index(es):
    • Date
    • Thread