3 ms·
Slightly off topic, but is there a good (i.e., fast and easy to use) modern retargetable GC for language prototyping/implementation? I've been looking for some
by cottonseed 12y ago
Slightly off topic, but is there a good (i.e., fast and easy to use) modern retargetable GC for language prototyping/implementation? I've been looking for something like this for a while, but it seems everyone rolls their own.
- papaf 12y agoFor prototyping could you use malloc without free? I have been rolling my own GC and wish that I would have left this until later.
- amenghra 12y agoYou could try using http://www.hboehm.info/gc/ http://www.hboehm.info/gc/ An alternative is to do reference counting (in your prototyping phase), which is much easier to implement.
- kjksf 12y agoBasic mark & sweep is simple to understand and implement. See e.g. https://code.google.com/p/tinypy/source/browse/trunk/tinypy/gc.c https://code.google.com/p/tinypy/source/browse/trunk/tinypy/... - 136 lines of C code in tinypy. You'll find more examples if you look at other small implementations. But you also want fast, at which point you have to accept that fast gc == complicated and tightly coupled to the implementation details (object layout, type/debug info). There is no pluggable GC. Conservative GCs (like Boehm GC) come the closest, but they have significant drawbacks (they blindly scan all of memory and can't tell a difference between a pointer and a random number that looks like a pointer, which means scanning&marking phase take longer and they keep objects that could have been freed, which is especially a problem on 32bits, where it's more likely that a random number points inside GC-managed heap).
- deleted 12y ago[deleted]
- signa11 12y agolua-jit reference is conspicuously missing : http://wiki.luajit.org/New-Garbage-Collector http://wiki.luajit.org/New-Garbage-Collector
- rayiner 12y agohttp://www.ravenbrook.com/project/mps/ http://www.ravenbrook.com/project/mps/