radical ideas about GC and ARC : need to be time driven?

Kagamin via Digitalmars-d digitalmars-d at puremagic.com
Tue May 13 07:59:41 PDT 2014


On Tuesday, 13 May 2014 at 12:18:06 UTC, Manu via Digitalmars-d 
wrote:
> It completely undermines the point. If you're prepared to call
> finalise, when you might as well call free... Every single 
> detail
> required to perform full manual memory management is required 
> to use
> finalise correctly.
> I see absolutely no point in a GC when used with objects that 
> require
> you to manually call finalise anyway.

Well, GC doesn't run immidiately, so you can't do eager resource 
management with it. GC manages memory, not other resources, and 
lots of people do see point in it: java and C# are industry 
quality technologies in wide use.

> ARC release is eager. It's extremely common that destructors 
> either
> expect to be called eagerly, or rely on proper destruction 
> ordering.
> Otherwise you end up with finalise again, read: unsafe manual 
> memory
> management :/

No language will figure out all algorithms for you, but this 
looks like a rare scenario: for example, kernel objects don't 
require ordered destruction.
Finalizer will be called when GC collects the object, it's a last 
resort cleanup, but it's not as unsafe as it used to be.


More information about the Digitalmars-d mailing list