• 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: confused about allocating and releasing objects
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: confused about allocating and releasing objects


  • Subject: Re: confused about allocating and releasing objects
  • From: mmalc crawford <email@hidden>
  • Date: Wed, 27 Aug 2008 10:34:48 -0700


On Aug 27, 2008, at 3:57 AM, Jonathan del Strother wrote:

Whats the difference between the two methods? (I know the second one creates
a blank dictionary first, and then loads the file - but I mean which one is
better for what purpose? - why would I choose one over the other).

Use whichever is easiest. Generally if I'm looking for a temporary object, I'll use the autoreleased method if present. If I'm going to keep the object around, I'll use the alloc/init method. But either of these can be transformed to the other with a retain or autorelease message, so there's no huge difference.

There is a non-trivial difference in that using alloc/init gives you direct control over the lifetime of the object, whereas using other methods does not. In general (but in particular in resource- constrained environments...), it is considered best practice to use alloc/init.

mmalc

_______________________________________________

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


References: 
 >confused about allocating and releasing objects (From: Memo Akten <email@hidden>)
 >Re: confused about allocating and releasing objects (From: "Jonathan del Strother" <email@hidden>)

  • Prev by Date: Re: Removing Applications from the Dock Programmatically
  • Next by Date: Re: Core Data - use of simple accessors vs. KVC
  • Previous by thread: Re: confused about allocating and releasing objects
  • Next by thread: Re: confused about allocating and releasing objects
  • Index(es):
    • Date
    • Thread