Invoke garbage collector? (Scoped Instances)

Jonathan M Davis jmdavisProg at gmx.com
Wed Feb 9 18:56:17 PST 2011


On Wednesday 09 February 2011 17:52:47 Sean Eskapp wrote:
> == Quote from Trass3r (un at known.com)'s article
> 
> > > However, I need the resources to be freed more quickly than the GC is
> > > apparently doing
> > 
> > You could use scoped instances if you need to clean them up soon after
> > creation.
> 
> To my knowledge, these are being removed from the language, and so, could
> only be used in the short-term.

Yes. They're inherently unsafe because of the risk of escaped references. 
std.typecons.scoped is intended as an alternative however, if you really want 
it. Personally, I'd generally advise against it unless profiling shows that you 
need it.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list