3 ms·
>> In what sense are they treated as one heap? How can they be, given that V8 uses a moving GC for its JavaScript heap? Does it just mean there's some mechanism
by wffurr 11d ago
>> In what sense are they treated as one heap? How can they be, given that V8 uses a moving GC for its JavaScript heap? Does it just mean there's some mechanism for a C++ object to refer to a JavaScript object, and vice versa?
There's a dead comment below that I vouched that goes into some detail: https://news.ycombinator.com/item?id=49709739 https://news.ycombinator.com/item?id=49709739
Essentially yes, C++ objects can refer to JS objects and vice-versa, but they don't share a heap, since, as you noted, the V8 JS heap uses a moving collector. They pass the Tracer object back and forth between the JS heap and C++ heap during GC.