• 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
[[Class alloc] init] preferable over [[Class instance] retain]?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[[Class alloc] init] preferable over [[Class instance] retain]?


  • Subject: [[Class alloc] init] preferable over [[Class instance] retain]?
  • From: Laurent Daudelin <email@hidden>
  • Date: Tue, 9 Mar 2010 13:41:03 -0800

I've been running in that situation and I'm just wondering if there are any advice for/against one or the other method.

For example, is:

NSMutableArray *anArray = [[NSMutableArray array] retain];

better than:

NSMutableArray *anArray = [[NSMutableArray alloc] init];

?

I know that for instances where I know in advance how many items, I imagine and expect that initWithCapacity: is better, but for those cases where you don't know?

-Laurent.
--
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 				http://nemesys.dyndns.org
Logiciels Nemesys Software              				email@hidden
Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries

_______________________________________________

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

  • Follow-Ups:
    • RE: [[Class alloc] init] preferable over [[Class instance] retain]?
      • From: Jeff Laing <email@hidden>
    • Re: [[Class alloc] init] preferable over [[Class instance] retain]?
      • From: "Sean McBride" <email@hidden>
    • Re: [[Class alloc] init] preferable over [[Class instance] retain]?
      • From: Luke the Hiesterman <email@hidden>
  • Prev by Date: Re: Question Re Memory Management in Apps
  • Next by Date: Re: [[Class alloc] init] preferable over [[Class instance] retain]?
  • Previous by thread: Re: How to get NSPathControl to resize programatically? (Solved..)
  • Next by thread: Re: [[Class alloc] init] preferable over [[Class instance] retain]?
  • Index(es):
    • Date
    • Thread