默认的Young代收集器,适用于Java 1.5、1.6、1.7和1.8?

huangapple go评论75阅读模式
英文:

the default collector for Young gen. of Java 1.5, 1.6, 1.7 and 1.8?

问题

我正在学习Java的垃圾回收技术,参考了https://c-guntur.github.io/java-gc上的文章。在阅读我标记的内容时,图片GENERATIONAL GC - TYPES - HISTORY

  • 并行收集器
    也称为吞吐量收集器 - Java 1.5及更高版本,默认收集器 Java 1.5、1.6、1.7和1.8 (* ↓)
    年轻代,仅使用并行(扫描)收集

  • 并发标记-清除(CMS)收集器(大多数情况下) - 从Java 1.5开始,一直到Java 1.8
    默认情况下,年轻代使用串行收集,而旧生代使用CMS收集器。

我有点困惑,Java 1.5、1.6、1.7和1.8的年轻代的默认收集器是什么?
非常感谢!

英文:

I'm learning the technology of gc of java,reference the article of https://c-guntur.github.io/java-gc when read about the content i marked,the pic
GENERATIONAL GC - TYPES - HISTORY

> Parallel Collector
a.k.a Throughput collector - Java 1.5 onwards, default collector Java 1.5, 1.6, 1.7 and 1.8 (* ↓)
Young gen., only has the parallel (scavenge) collection.

> Concurrent Mark-Sweep (CMS) Collector (mostly*) - available Java 1.5 onwards until Java 1.8
By default, Young gen. uses a serial collection and Tenured gen. use a CMS collector.

I'm a little confused what is the default collector for Young gen. of Java 1.5, 1.6, 1.7 and 1.8?
Thanks a lot

答案1

得分: 0

年轻一代收集算法自早期以来并没有发生太大改变。

年轻一代被分为三个区域:伊甸园和两个幸存者空间。伊甸园空间实际上被维护为一个带有指针的堆栈。当一个对象在实例化期间需要分配空间时,当前的指针引用被使用,并且指针会按对象的大小递增。这就是指针增长,非常快速(实际上大约需要6条指令,比调用malloc更快)。唯一真正的变化是引入了线程本地分配缓冲区(TLABs)。我不确定这是什么时候引入的,但它们在JDK 5中存在。它们为每个线程在伊甸园中分配一个区域,以避免需要锁定和在分配期间可能出现的争用。

当年轻一代需要收集时,所有存活的对象都会被复制到“to”幸存者空间,以及在“from”幸存者空间中的所有尚未达到老年代的对象(此时它们将成为老年代的一部分)。

英文:

The young generation collector algorithm hasn't really changed much since the early days.

The young generation is divided into three regions: Eden and two survivor spaces. Eden space is maintained, in effect, as a stack with a pointer. When an object needs space allocated during instantiation, the current pointer reference is used and the pointer is incremented by the size of the object. This is pointer bumping and is very fast (actually about 6 instructions and faster than a call to malloc). The only real change to this was the introduction of thread local allocation buffers (TLABs). I'm not sure when these were introduced but they were there in JDK 5. These allocate an area in Eden for each thread to avoid the need for a lock and possible contention during allocation.

When the young generation needs collecting, all live objects are copied to the to survivor space, along with any live objects in the from survivor space that have not reached the tenuring threshold (at which point they are tenured to the old gen.)

答案2

得分: 0

感谢大家的帮助,正如Alexey Ragozin所说,“default”似乎不完全准确,我在Oracle找到了更好的文章,详细介绍了Java垃圾回收基础知识。你可以在以下链接找到更多信息:

  1. Java垃圾回收基础知识:链接

  2. 使用Java虚拟机5.0进行垃圾回收调优:链接

英文:

Thanks all for your help,as Alexey Ragozin said "default" seems not exactly, i find better articles from Oracle cover the detail 1.Java Garbage Collection Basics https://www.oracle.com/webfolder/technetwork/tutorials/obe/java/gc01/index.html#RequiredSoftware 2.Tuning Garbage Collection with the 5.0 Java Virtual Machine https://www.oracle.com/java/technologies/tuning-garbage-collection-v50-java-virtual-machine.html#1.1.Introduction-Coutline

huangapple
  • 本文由 发表于 2020年8月14日 13:27:50
  • 转载请务必保留本文链接:https://go.coder-hub.com/63407064.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定