There are two general ways to deal with GC pauses in programs requiring a near-realtime response. You can use a realtime GC algorithm which amortizes the GC work across all allocations and guarantees a bounded response time, or you can guarantee that there is sufficient free memory available to run the critical path without invoking the GC. The latter is most suitable when the program can expect a certain amount of idle time, e.g. between frames. It should be a simple matter of determining how much memory is needed to render a frame and then adding a call to the GC just before going idle to free at least that much space for the next frame.