Thought on limiting scope of GC

Jerry jlquinn at optonline.net
Thu Feb 13 20:41:42 PST 2014


Hi all,

I just had the following thought on limiting the gc in regions.  I don't
know if this would address some of Manu's concerns, but here goes:

My thought is to have something like the following:

GC.track();
auto obj = allocateStuff();
GC.cleanup(obj);

The idea here is that track() tells GC to explicitly track all objects
created from that point until the cleanup call.  The cleanup() call
tells gc to limit its collection to those objects allocated since the
track() call.  The obj parameter tells gc to consider obj live.

This way, you can avoid tracking everything that may get created, but
you can limit how much work gets done.

Comments? Slams?

Jerry


More information about the Digitalmars-d mailing list