A common problem arising from embedding a virtual machine as a component in a larger software system is the management of references between the VM’s managed heap and the embedder’s heap. Direct references between components allow fast communication, but can result in cycles over component boundaries, making these hybrid systems prone to memory leaks. In this paper we present a design and implementation of a tracing mechanism for effective and efficient garbage collection over component boundaries which is implemented and shipped in Chrome’s JavaScript virtual machine V8 and the Blink rendering engine. Tracing through the C++ heap of Blink poses several challenges on which we elaborate: 1) an abstract visitation mechanism for C++ objects that can be used by the V8 garbage collector, 2) write barriers for C++ objects to reduce pauses through incremental marking, and 3) a mechanism to verify correctness of write barrier usage.
Presented at MoreVMs workshop, Brussels, Belgium, 2017.