Re: More memory allocation questions
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.