Some notes on garbage collection
Not logged in

Herewith are some brief notes on garbage collection, current on 2012-07-16:

Right now cowjac has no garbage collection (which means garbage accrues indefinitely), but most of the hooks are in place for some. Actually adding a simple mark/sweep collector should be easy.

The basic setup is:

In order to do a collection, then, all we need to do is:

This is a stop-the-world collector, and is not necessarily that efficient. But it should be simple to implement, reasonably easy to debug, and may stand a chance of working.

Note that there a couple of places in cowjac where live references aren't anchored: exceptions in flight, for example. This imposes certain constraints on what we can do. These can probably all be fixed later, but for now this approach should be fine.