Re: Anything bad about allocWithZone: [self zone]?
Re: Anything bad about allocWithZone: [self zone]?
- Subject: Re: Anything bad about allocWithZone: [self zone]?
- From: Tom Sutcliffe <email@hidden>
- Date: Fri, 8 Aug 2003 02:07:17 +0100
On Thursday, August 7, 2003, at 09:23 am, Wade Tregaskis wrote:
If I understand correctly, I don't see any reason to not always use
allocWithZone: [self zone] (self being whatever object is creating
another). Yet, I don't see it "enforced" or suggested much. Is
there anything bad about doing this? Should I replace all my alloc's
with allocWithZone: [self zone] ?
(thus, in a document based app, just about everything would be
allocated in the same zone as the given NSDocument object)
I believe allocWithZone is depreciated.
Well I don't think Zones have been formally deprecated but they're
certainly rather low-profile.
It's a good point though, should objects be created in the default zone
or in that of their parent? Not thought about it before. I don't think
the default alloc method could tell who was calling it, so you couldn't
get it automatically. But if you could, you could just poseAsClass
NSObject and voila.
If you don't use different zones (and I admit, I never have) then
there's no problem. I haven't really found a use for them. I wonder if
allocWithZone is being retired because no-one really uses it? Sounds
plausible.
In summary I don't think there's anything wrong with what you suggest,
just that there doesn't seem like much point.
Tom
ps I keep meaning to write a non-paged memory wrapper, and a subclass
of NSSecureTextField, so super-paranoid apps could be certain that
passwords etc would never be paged to disk. I'd welcome any expert's
opinion on this, and on whether it's simpler and safer to make the
whole app memory resident.
_______________________________________________
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.