Take the 2-minute tour ×

I'm writing tools for building games in .NET using functional style. For this, I will need an incremental GC, or some type of GC whose collection times are bounded to 1 ms or so. I read a paper on a real-time incremental GC that is a WIP for mono, but I can't find anyway to look at its code or to use it - http://static.usenix.org/event/vm04/wips/goh.pdf

To clarify what I mean by 'incremental GC', an incremental GC splits an individual garbage collection cycle into multiple slices of work that can be interleaved with program execution so that each slice can be processed in a relatively bounded amount of time. The primary intent of an incremental GC feature is to support soft-real-time applications by keeping them consistently responsive at a relatively fine-grained level. Incremental GCs elide the 'embarrassing pause' caused by mainstream GCs such as .NET's generational GC. Many systems that use incremental GC have collection pauses bound roughly at 1ms. This is perfect for games as they need to run their whole cycle inside 16.667ms. The .NET generational GC, OTOH, will cause typical pauses of 200ms.

I really would like to avoid sinking the time into writing my own incremental GC for mono, so if someone could tell me what alternative (soft)real-time centric GCs are currently available, that would be great. If I need to write my own GC, it would be great to have an open source GC that would serve as a good reference for someone writing their own mono GC from scratch.

EDIT: added elaboration of what is meant by 'incremental' GC.

share|improve this question
Cody, I'm afraid you are wrong about generational GC's being incremental. It is a common mistake to conflate incrementalism with generationalism. They are aboslutey orthogonal. I suggest some general research on incremental GCs (perhaps start with the Train Algorithm as that's how I familiarized myself with them cs.au.dk/~beta/Papers/Train/train.html). GHC also has an expiremental incremental GC descirbed here - pubs.doc.ic.ac.uk/incremental-garbage-barrier/… . A typical stop-the-world time for my apps is around 200 ms. Definitely unacceptable. –  Bryan Edds Jul 26 '12 at 14:00
Here's a thread that gives some more background on the subject, the explaining the non-relation between incremental and generational algorithms - forums.create.msdn.com/forums/t/103653.aspx and cs.hubfs.net/topic/Some/0/75351 –  Bryan Edds Jul 26 '12 at 14:17
I don't really have time to read through all of those articles, unfortunately. And I'm also not sure what happened to my comment. I assume that a couple of people flagged it as spam (??!) because you thought it was incorrect, which caused it to be automatically removed. I said that a generational garbage collector is always incremental because it does not collect all of the objects during a single collection cycle, but that the converse does not necessarily hold (e.g., an incremental garbage collector is not necessarily incremental). Perhaps it's a difference in definition of terminology. –  Cody Gray Jul 26 '12 at 23:47
Ack, that's my bad. I can't down-vote yet, so I marked it as 'unhelpful'. Didn't realize it would disappear or be consider spam. At any rate, your definition of incremental is of the more ad hoc sort and is unrelated to my definition I'm using, which is the more formal sort. The formal definition of incremental involves splitting a single collection cycle into multiple slices of work that can be done in a relatively bounded amount of time. The formal definition is used here - en.wikipedia.org/wiki/… –  Bryan Edds Jul 27 '12 at 12:34
@BryanEdds: you can't down-vote comments at all. On-topic, .NET 4 includes a background GC which might impact you less (msdn.microsoft.com/en-us/library/…), though I doubt that's made it to Mono yet either. –  Dan Puzey Aug 2 '12 at 13:45
show 11 more comments

1 Answer

up vote 5 down vote accepted

I don't know if there is an incremental GC for Mono with sources - but there is one (targeted for an oCaml-derived language) that is both open source and seems to be focused on high-performance called HLVM. The author, Jon Harrop also has a blog here with many excellent articles on garbage collection and related technologies.

Hope this helps!

share|improve this answer
add comment

Your Answer


