On Tue, May 15, 2012 at 2:51 PM, Raoul Duke <[email protected]> wrote:

> in other words: the game folks already do all sorts of tricks...
>

Game engines are an interesting case, and a very different approach may be
possible.

If I understand how the allocating rendering engines work (and I probably
don't), there are a lot of dynamic allocations of a small number of object
types. One way to avoid GC in these cases is to pre-allocate a vector of
objects for each of these object types, and then implement a traditional
manual allocation scheme using that vector as the backing store. Since
these objects are not allocated from the collection heap, they don't
trigger GC.

The good news is that you'll still get type safety even if you reallocate
an object that is in use. The bad news is that when you mistakenly
deallocate an object that turns out to still be in use, you'll have a
*very* hard
time finding the source of the error. Mark Miller has proposed using
(pointer,version) pairs and keeping an allocation count in the target
object header to help catch this type of mistake.


shap
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to