且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

V8如何处理“大对象空间"中的对象?

更新时间:2023-01-12 15:06:30

(此处为V8开发人员.)Bergi的评论正确.大型对象不会移动到大型对象空间,它们是在大型对象空间中创建的.只要它们还活着,它们就不会移动.但是它们像其他任何对象一样被垃圾回收:当GC检测到它们不再存在时,内存将被释放.通常,释放死物体并不涉及移动它们.

(V8 developer here.) Bergi's comment is correct. Large objects are not moved to large object space, they are created in large object space. As long as they are alive, they are not moved. But they are garbage collected like any other object: when the GC detects that they are no longer live, the memory will be freed. In general, freeing dead objects does not involve moving them.