[JAVA] [Deprecated] Getting started with JVM GC and memory management that I didn't understand

!! !! !! I made a mistake in some places, so I rewrote the revised version! !! !! Revised edition Introduction to the GC mechanism of JVM

Introduction

It mentions the GC algorithm and the role of each area in the heap area.

There are various types of GC algorithms themselves. The following two are the most basic.

Basic algorithm

-Reference Counter --Referenced minute count. Cross-references cannot be erased.

Mark & Sweep is the standard in Java

Measures against heap area fragmentation

If the unnecessary area is released repeatedly, the empty area becomes uneven and inflexible. => The processing cost of creating a new object increases.

Therefore, the following algorithms are combined.

** This is why the heap area has a From area and a To area. ** **

There are two major challenges in processing GC

--Stop the world to reduce application downtime as much as possible while doing GC --Since the processing load is high when GC is applied to all target memory areas (FullGC), you want to reduce the load of one GC.

Therefore, in order to solve these problems, in the actual JVM, algorithms such as generational GC are combined with the basic algorithm (Mark & Sweep).

** Part of that is that there are New and Old in the heap area of the JVM. This is intended to limit the scope of GC and distribute the load by the generational GC algorithm. ** **

Reference: GC by generation

There are different types of JVM memory areas based on the GC algorithm.

From the contents so far

--The reason why there are New and Old in the heap area is to limit the area targeted for GC and distribute the processing load. (Does the Eden area in New also exist because you want to remove the newly created object from the GC target and separate it?)

--The reason why From and To are separated in the New and Old areas is to perform copying to prevent fragmentation of the heap area.

reference

Java heap memory management mechanism

JVM tuning

Digression

An algorithm called Garbage First Garbage Collection is coming ...?

Recommended Posts

[Deprecated] Getting started with JVM GC and memory management that I didn't understand
Getting started with the JVM's GC mechanism
Getting Started with Java_Chapter 8_About Instances and Classes
I tried Getting Started with Gradle on Heroku
I started MySQL 5.7 with docker-compose and tried to connect
Java memory management and how to read GC Viewer
Getting Started with DBUnit
Getting Started with Ruby
Getting Started with Swift
Getting Started with Docker
Getting Started with Doma-Transactions
I didn't understand the behavior of Java Scanner and .nextLine ().
Getting started with Java and creating an AsciiDoc editor with JavaFX
Getting Started with Reactive Streams and the JDK 9 Flow API