Eliminate class allocators and deallocators?
Christopher Wright
dhasenan at gmail.com
Tue Oct 6 16:13:08 PDT 2009
What exactly is your suggestion?
It seems that you mean that:
delete obj;
should call a destructor but not call delete() or notify the GC that the
memory is free.
You're saying that there is a problem, but you're not telling us what's
wrong. Why the hell do you want to destroy an object without recycling
its memory? Why does the inability to do so cause a problem?
It seems like a performance hack to me -- you've got an object that
isn't valid anymore, but you want to hang on to the memory for some
other purpose. And you could override new() and delete(), but you don't
want to incur the performance penalty of calling the runtime to fetch
the deallocator.
The only remaining use that I see is a way to reset a shared object
without explicitly passing around a reference to the new version of the
object. This seems potentially dangerous, and nothing I want for default
behavior.
More information about the Digitalmars-d
mailing list