• 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: More memory allocation questions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: More memory allocation questions


  • Subject: Re: More memory allocation questions
  • From: Shawn Erickson <email@hidden>
  • Date: Sun, 28 Jul 2002 15:03:24 -0700

On Sunday, July 28, 2002, at 01:43 PM, Marcel Weiher wrote:


If you don't alloc/init an object, you shouldn't release it.

If you don't: +alloc, -copy, -retain an object. -init doesn't play a part.

small nit...

-init can play a part if it happens to internally allocate a different object (or retaining a shared object) and returns that to you instead of the object you +alloc(ed). If -init does this it will make sure to release the one you allocated before it returns.

With that said you really don't call init yourself without also calling alloc ([[SomeClass alloc] init]).

-Shawn
_______________________________________________
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.

  • Follow-Ups:
    • Re: More memory allocation questions
      • From: Marcel Weiher <email@hidden>
References: 
 >Re: More memory allocation questions (From: Marcel Weiher <email@hidden>)

  • Prev by Date: Re: Serial number verification / obfuscation (was: Re: Hiding
  • Next by Date: Re: Alternate for NSUIElement
  • Previous by thread: Re: More memory allocation questions
  • Next by thread: Re: More memory allocation questions
  • Index(es):
    • Date
    • Thread