Re: Memory Mania Revisted
Re: Memory Mania Revisted
- Subject: Re: Memory Mania Revisted
- From: Izidor Jerebic <email@hidden>
- Date: Tue, 12 Feb 2002 16:11:17 +0100
On Tuesday, February 12, 2002, at 01:26 AM, email@hidden wrote:
Apparently, the shift to [[Foo alloc] init] from +new
happened around NeXTSTEP 2.0, and there may be something
in the 2.0/2.1 release notes.
The rationale was apparently related to the use of memory
zones, using +allocWithZone. Zones were introduced in 2.0
Interesting. Now, of course, use of zones is discouraged (they are
believed to actually make one's app *less* efficient, given the current
way memory allocation works in X), opening the way for a new renaissance
for +new... ;->
Well, main reason for alloc/init splitting as I remember was that when you
do archiving/unarchiving (distributed objects, nib files, other document
files, etc.), it is useful to have allocation and initialization as
separate activities, so you can do -init for new objects and
-initWithCoder: for archived objects which read values from somewhere.
And allocation of object (getting memory etc.) is something completely
different than initialization, IMHO, so it is good to have those two
things separated, anyway.
izidor
_______________________________________________
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.