Re: Memory Mania Revisted
Re: Memory Mania Revisted
- Subject: Re: Memory Mania Revisted
- From: David Rehring <email@hidden>
- Date: Sun, 10 Feb 2002 12:38:31 -0800
On 2/10/02 10:03 AM, Nicholas Shanks at email@hidden wrote:
>
So, from what I've gathered reading this (rather interesting) thread,
>
[NSSomeObject new] is entirely equivalent to/synonymous with
>
[[NSSomeObject alloc] init]
>
>
Is this correct?
Sometimes.
It depends on the specific implementation for each class. Some classes may
choose to 'cache' instances of themselves, so the first time through, they
may just call through to alloc/init, but subsequently, they would return the
same object instead of creating a new one.
Ideally, the documentation should clearly spell out the differences, if any,
there would be between new and alloc/init, for each class that supports new.
Slightly less ideally, you should check the implementation to see what the
difference is, if any.
Unfortunately, you're stuck with less-than-ideal documentation...
Later,
--
David Rehring Psychos do not explode when light hits
Senior Software Engineer them, no matter how crazy they are...
Atimi Software, Inc.
www.atimi.com And totally insane guy!
_______________________________________________
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.