------- Comment #3 from  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.


Reply via email to