GC has a "barbaric" destroyng model, I think
Kagamin via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Feb 12 01:26:12 PST 2015
On Thursday, 12 February 2015 at 08:55:43 UTC, Jonathan M Davis
wrote:
> On Thursday, February 12, 2015 08:33:34 Kagamin via
> Digitalmars-d-learn wrote:
>> Truth be told, D has no guideline for deterministic destruction
>> of managed resources.
>
> Really what it comes down to is that if you want deterministic
> destruction,
> you _don't_ use managed resources. You use malloc and free
> rather than new
> and the GC. Granted, that's way uglier than it should be right
> now, because
> the allocator stuff hasn't been finished yet, but it's really
> what's
> required if you want an object on the heap to have a
> deterministic lifetime.
> Memory that's managed by a GC just doesn't work that way.
That's a repetition of C++ atavism, that resource management ==
memory management. IStream is a traditional example of a
GC-managed object, which needs deterministic destruction, and not
because it consumes memory, but because it encapsulates an
unmanaged resource, it has nothing to do with memory management,
malloc and free.
More information about the Digitalmars-d-learn
mailing list