Why does D rely on a GC?

Kagamin via Digitalmars-d digitalmars-d at puremagic.com
Tue Aug 26 00:49:05 PDT 2014


On Tuesday, 26 August 2014 at 07:10:32 UTC, Marco Leise wrote:
> In practice you then add .close/.release methods to every
> resource object

Yes.

> and here we are back at malloc/free.

No.

GC exists because general purpose memory has different properties 
and used in a different ways than other resources. For example, 
you can't build a cycle of files. Hence different ways of 
management for memory and other types of resources. And people 
coming from unmanaged environments, like C++, should learn about 
that difference and how to manage resources in GC environment. I 
agree it's a problem there's no tutorial for that. Maybe, .net 
tutorials can be used to teach it.


More information about the Digitalmars-d mailing list