Classic garbage collector - illustration

Foreword

This article is the "in-depth understanding of the Java Virtual Machine (3rd edition)," the study notes.


Classic garbage collector

The new generation of collectors

Serial Collector

  • Overview: single-threaded operating collector must perform garbage collection STW

  • Garbage collection algorithm

    • Replication algorithm
  • advantage

      1. Simple and efficient
      1. All collectors inside the consume minimal additional memory

ParNew collector

  • Serial essentially a collector of multi-threaded parallel version

  • Garbage collection algorithm

    • Replication algorithm
  • ParNew incorporated into subsequent versions of CMS to deal specifically with the new generation

Parallel Scavenge collector

  • Parallel certain controllable collector

  • Shorten the time of garbage collection and throughput at the expense of the new generation of space at the expense of the exchange, after the new generation of small tune, a direct result of garbage collection occurs more frequently, the throughput will drop down

  • Garbage collection algorithm

    • Replication algorithm

Collector years old

Serial Old collectors

  • Serial old collector's edition

  • Garbage collection algorithm

    • Mark - Collation Algorithm

CMS (Concurrent Mark Sweep) collector

  • The first real sense of support concurrent garbage collector, for the first time let the garbage collection thread and the user thread (essentially) simultaneously

  • Garbage collection algorithm

    • Mark - sweep algorithm
  • advantage

    • Concurrent low pause
  • Shortcoming

    • CMS collector can only ParNew or Serial collectors with the work, can not work together and Parallel Scavenge. jdk1.9 version will be incorporated into the CMS ParNew deal specifically with the new generation
    • As a result of mark - sweep algorithm, when too much space debris, a large space object allocation will bring trouble, often have to trigger Full GC in advance. Methods to solve defragmenting before entering Full GC
  • The labeling process

    • The initial mark -> concurrent mark -> relabeled -> Concurrent Clear

Parallel Old collectors

  • Parallel Scavenge collector's editions of old

  • Garbage collection algorithm

    • Mark - Collation Algorithm

The new generation and the old collector's

G1 (Garbage First) Collector

  • concept

    • Not fixed the new generation's old design, but the continuous Java heap is divided into multiple independent regions of equal size (Region), each Region according to the needs of the new generation of space to play Eden, Survivor space, or years old space. Collector adopt different strategies for playing the role of the Region to deal with unreasonable
  • Feature

      1. You can specify the maximum pause time
      1. Memory layout sub-Region
      1. By dynamically determining earnings back to collect
  • Garbage collection algorithm

    • Based on the overall mark - sorting algorithm based on partial tag - replication algorithm
  • The labeling process

    • Initial labels -> concurrent mark -> End tag -> Filter Recycling

Shenandoah collector

  • RedHat has developed, openJDK12 new features, Oracle explicitly refused to support. And G1 highly similar, or even better than the G1. Yourself about

Author: Mi Qiluo
link: https: //juejin.im/post/5e7f0b926fb9a03c947cb8b5
Source: Nuggets
copyright reserved by the authors. Commercial reprint please contact the author authorized, non-commercial reprint please indicate the source.

Guess you like

Origin www.cnblogs.com/zhooong/p/12590518.html