Destructors vs. Finalizers
Guillaume Piolat via Digitalmars-d
digitalmars-d at puremagic.com
Thu Jul 27 06:28:43 PDT 2017
For cycle in RC you either do it like other RC system and break
cycles manually, or create a parent owner to own every things
pointing to each other and having cycles.
On Thursday, 27 July 2017 at 11:43:37 UTC, Steven Schveighoffer
wrote:
> This is an unworkable solution.
Not at all unworkable, it's much easier than mixed strategies.
> One simple time you forget to clean up deterministically and
> then you corrupt memory by using members that are already
> cleaned up.
Once again, this is the reason of the existence of the
GC-Proof-resource-class, which have the GC warn you of
non-deterministic destruction at debug time.
In the very case you mention it will tell you "you have forgot to
release one resource T deterministically".
> Or, you disable calling destructors in the GC, and instead leak
> resources.
As I said in previous messages, not all resources can be
destroyed by the GC: they have to fit into 3 different
constraints.
I'll leave the discussion, you seem to ignore my arguments in
what seems as an attempt to have the last word.
More information about the Digitalmars-d
mailing list