Re: Newbie with stupid question cont.
Re: Newbie with stupid question cont.
- Subject: Re: Newbie with stupid question cont.
- From: email@hidden
- Date: Tue, 19 Mar 2002 13:53:29 -0800
Wasn't it possible to re-init objects in Objective-C? I was thinking
about it as a possible approach to avoiding the memory manager overhead
in some easily controlled cases (like the one in the thread starting
post), but I guess there's problems with that approach, like ensuring
the destructor gets called. Would this be a case where manually sending
dealloc would be a sensible thing to do?
There is a problem with getting the object to "deconstruct" without
actually freeing its memory; I'm not sure how one would solve that. I
*think* manually calling -dealloc will not do what you want. Overriding
dealloc and not calling super might, but you'd want to inherit directly
from NSObject to be able to get away with that, and even then you might
have some problems.
There is also a problem with instances potentially being different
sizes and such; this would probably bite you with cluster classes. You
need to know that +alloc and -init... are actually doing what you
expect, and are not hiding complexity the way they do in cluster class
implementations.
I looked into doing this briefly at Apple, and decided it was too
complicated to be worth the effort. Other low-hanging fruit probably
exists that will improve your performance without going to these
extremes. I would recommend that only real experts in Cocoa should try
doing this.
Someone posted a URL to a related (although not exactly on-topic)
article recently:
http://www.mulle-
kybernetik.com/artikel/Optimization/opti-5.html.
Ben Haller
Stick Software
_______________________________________________
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.