• 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: object Allocation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: object Allocation


  • Subject: Re: object Allocation
  • From: Fritz Anderson <email@hidden>
  • Date: Wed, 19 Apr 2006 15:36:27 -0500

Reservations clerk, testily: I _know_ what a "reservation" is, sir!

Jerry Seinfeld: No, I don't think you do. If you did, we wouldn't be having this problem.

On Apr 19, 2006, at 3:18 PM, Jerrod Fowkes wrote:

thank you, however I have a firm enough grasp on retain and release. I just need to know where it is being applied.

Objects returned from most methods are autoreleased (or at least not incremented in retain count for your purposes), unless the method contains the words "alloc," "new," or "copy." (There is one exception, a "new" in Core Data, but it is very embarrassed.) In the method name in


newDictionary = [NSDictionary dictionaryWithDictionary: oldDictionary];

none of the magic words appear. This means that the returned object is subject to deallocation in the next iteration of the run loop. In

newDictionary = [[NSDictionary alloc] initWithDictionary: oldDictionary];

the magic word "alloc" appears. It's your responsibility to release it.

The tutorial Nick (quite civilly) referred you to explains this.

	-- F

_______________________________________________
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


References: 
 >Re: object Allocation (From: Jerrod Fowkes <email@hidden>)

  • Prev by Date: Re: Generating a "left-arrow key" event
  • Next by Date: Re: Implementation across several files
  • Previous by thread: Re: object Allocation
  • Next by thread: Re: object Allocation
  • Index(es):
    • Date
    • Thread