[Issue 2858] D specs allow GC implementations that don't call finalizers

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Apr 19 16:31:00 PDT 2009


http://d.puremagic.com/issues/show_bug.cgi?id=2858





------- Comment #3 from smjg at iname.com  2009-04-19 18:31 -------
(In reply to comment #2)
> I agree that making the finalizers more deterministic is a good idea.
> As discussed in the NG I see two problems:
> 
> 1) the use of finalizers for any non memory related resource is dangerous and
> should be avoided if possible. This because GC collections happens when the
> memory is constrained, not when the resource is constrained, and so one might
> unwillingly exhaust it. Thus making people use finalizers more and rely on the
> GC is not necessarily a good idea.

SDWF tries to get around this by running a collection if creation of a GDI
object fails, in case it frees some system resources in order to try again. 
But maybe what we really need is some kind of monitoring system.  How does
DMD's GC decide when to run, anyway?  Maybe something similar could be
implemented for Windows system resources.

Besides, it doesn't make people rely on the GC.  Users of the library are free
to use scope objects or manually delete them if they want.


-- 



More information about the Digitalmars-d-bugs mailing list