• 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: Should objects returned by indirection be autoreleased
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Should objects returned by indirection be autoreleased


  • Subject: Re: Should objects returned by indirection be autoreleased
  • From: Jim Correia <email@hidden>
  • Date: Fri, 12 May 2006 08:42:59 -0400

On May 11, 2006, at 8:15 PM, Eric wrote:

For example, this NSFormatter method:

- (BOOL)getObjectValue:(id *)anObject forString:(NSString *)string
errorDescription:(NSString **)error

Should the two indirectly returned objects (anObject and error) be
autoreleased? In other word, if I get an object from any method other than
alloc, etc., no matter how it's returned, it should be autoreleased,
correct?

If you -alloc, -copy, -mutableCopy, -new and object you must release it.

You are not responsible for releasing objects returned by reference. (*) Was the object autoreleased? You don't know, and you don't care. The only thing you know is that you aren't responsible for releasing it.

[*] Though there is at least one notable, documented exception.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Should objects returned by indirection be autoreleased
      • From: Jim Correia <email@hidden>
References: 
 >Should objects returned by indirection be autoreleased (From: Eric <email@hidden>)

  • Prev by Date: Re: NSDrawer in System Pref Pane
  • Next by Date: Re: Should objects returned by indirection be autoreleased
  • Previous by thread: Re: Should objects returned by indirection be autoreleased
  • Next by thread: Re: Should objects returned by indirection be autoreleased
  • Index(es):
    • Date
    • Thread