Java V8如何管理其堆?

Java V8如何管理其堆?,java,garbage-collection,heap,v8,mark-and-sweep,Java,Garbage Collection,Heap,V8,Mark And Sweep,我知道当V8的垃圾收集工作时,它将从GC的根进行跟踪,以便标记不可访问的对象,然后进行扫描。我的问题是GC如何遍历这些对象?必须有一个数据结构来存储所有可访问或不可访问的对象。位图?链接表 顺便说一句,JVM也这么做吗 Google的V8堆被组织成几个不同的空间。有一篇很棒的帖子,“”解释了V8堆是如何组织的: New-space: Most objects are allocated here. New-space is small and is designed to be garbage

我知道当V8的垃圾收集工作时,它将从GC的根进行跟踪,以便标记不可访问的对象,然后进行扫描。我的问题是GC如何遍历这些对象?必须有一个数据结构来存储所有可访问或不可访问的对象。位图?链接表

顺便说一句,JVM也这么做吗

Google的V8堆被组织成几个不同的空间。有一篇很棒的帖子,“”解释了V8堆是如何组织的:

New-space: Most objects are allocated here. New-space is small and is
designed to be garbage collected very quickly, independent of other
spaces.

Old-pointer-space: Contains most objects which may have pointers to 
other objects. Most objects are moved here after surviving in new-space 
for a while.

Old-data-space: Contains objects which just contain raw data (no 
pointers to other objects). Strings, boxed numbers, and arrays of
unboxed doubles are moved here after surviving in new-space for a 
while.

Large-object-space: This space contains objects which are larger than
the size limits of other spaces. Each object gets its own mmap'd region
of memory. Large objects are never moved by the garbage collector.

Code-space: Code objects, which contain JITed instructions, are 
allocated here. This is the only space with executable memory (although
Codes may be allocated in large-object-space, and those are executable, too).

Cell-space, property-cell-space and map-space: These spaces contain
Cells, PropertyCells, and Maps, respectively. Each of these spaces
contains objects which are all the same size and has some constraints 
on what kind of objects they point to, which simplifies collection.
Conrad的文章接着解释了V8 GC是从

V8的堆实现位于和中。堆的初始化从第5423行开始。的
第615行
中找到的方法
Address NewSpaceStart()
包含新空间开始的地址位置,并且通过利用时间局部性将对象存储在何处

现在来看第二个问题:JVM也这样做吗?一个有趣的事实:有3个主要的生产JVM,它们都以不同的方式实现GC算法。有一个很棒的性能博客写了一篇文章,“,将进一步详细讨论它们的实现

还有GC的风格,比如如果你想要一个,如果你想要,和

如果您有任何问题,请告诉我

谢谢你抽出时间


温馨的问候,

您是否想知道所有可及/不可及的事物,还是根源?我自己对v8不太了解,但我知道大多数地面军事系统的答案都很复杂,我也不太确定你在寻找答案的哪一部分。谢谢你的回答。它非常接近我想要的。还有一个问题,物体是如何在一个空间中组织的。例如,在旧的数据空间中,GC开始从根跟踪到任何可访问的对象,并使用指针获取它们的地址以标记它们。未标记的将被扫描,但当无法访问时,GC如何知道它们的地址和长度?