GC, the simple solution
Lionello Lunesu
lionello at lunesu.remove.com
Sun Jun 4 05:39:34 PDT 2006
> * Destructors are called immediatly if the counter goes zero.
This is not such a good thing! You don't really know who releases the last
reference, so you don't really know when the object is deleted. If the
object is being referenced from multiple threads, you don't know in what
thread the destructor will run.
> * all logic behaviour is deterministic
See above.
> * Member objects are still valid, while a destructor is called. => no
> more dispose/close patterns
When an object is being destructed, the references it has to other objects
are being released. So in the destructor of object B, object A might have
released about half its references.
> * consume only the needed memory
What about circular references? They'll never get released, no clean-up.
L.
More information about the Digitalmars-d
mailing list