• 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: Marcel Weiher <email@hidden>
  • Date: Mon, 29 Jul 2002 08:03:13 +0200

On Monday, July 29, 2002, at 12:03 Uhr, Shawn Erickson wrote:


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.

No. Init *still* doesn't play a part in it, because what it did was transparent. It got an object with a retain-count of 1 from +alloc, and it returns an object with a retain count of 1. For the client, nothing has changed.

Marcel

--
Marcel Weiher Metaobject Software Technologies
email@hidden www.metaobject.com
Metaprogramming for the Graphic Arts. HOM, IDEAs, MetaAd etc.
_______________________________________________
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.

References: 
 >Re: More memory allocation questions (From: Shawn Erickson <email@hidden>)

  • Prev by Date: Re: NSUserDefaults, an array, and SIGBUS 10
  • Next by Date: Re: ask about sleep function
  • Previous by thread: Re: More memory allocation questions
  • Next by thread: Re: More memory allocation questions
  • Index(es):
    • Date
    • Thread