Seems to work. There is a problem though: triggering GC outside of the mainloop is not well-defined. This basicly boils down to the fact that the GC managed memory is owned by the interpreter. The caller of _sc_run() has no business using these data structures. It's useful for testing though. It's necessary to perform a GC before doing any allocation to prevent corruption.