Two closely related topics here: 1. It is often nice to be able to create a single object that works with both GC and deterministic memory management. The idea is that, if delete is called manually, all sub-objects would be freed deterministically, but the object could still safely be GC'd. Since the destructor called by the GC can't reference sub-objects, would it be feasible to have two destructors for each class, one that is called when delete is invoked manually and another that is called by the GC?
2. One possible solution is to allocate the sub-objects whose lifetimes can't exceed that of the main object on the C heap, and put std.c.stdlib.free() calls in the destructor. However, according to the spec, the GC is not guaranteed to call the destructor for all unreferenced objects. Under what circumstances would the d'tor not get called, leading to a memory leak if this strategy was used?
