Home >php教程 >PHP开发 >Garbage collector in JVM

Garbage collector in JVM

高洛峰
高洛峰Original
2016-11-22 16:56:122009browse

Serial collector: A new generation single-threaded collector that uses a copy algorithm for recycling. While it's garbage collecting, all threads from other users will be paused.

Serial Old Collector: The old generation version of Serial uses the mark-clear algorithm and is also a single-threaded collector.

ParNew collector: ParNew collector is actually a multi-threaded version of Serial. Except for multi-threaded garbage collection, the rest including collection algorithm (copy algorithm), object allocation rules, recycling strategy, etc. are exactly the same as Serial collector.

Parallel Scavenge collector: It is a new generation collector that uses a copy algorithm and is a parallel multi-threaded collector. This collector is designed to improve the throughput of the system (time to run user code/(running time) User code time + garbage collection time)), so the Parallel Scavenger collector is also called the "throughput first" collector.

Parallel Old Collector: It is the old generation version of Parallel Scavenge Collector, using the ‘mark-clear’ algorithm.

CMS Collector: Pays special attention to the response speed of user services, and hopes that the system pause time will be the shortest to provide users with a better experience. Concurrent collection, low pause. Instead, a ‘mark-and-sweep’ algorithm is used.

G1 collector: one of the most cutting-edge technologies in the development of current collector technology

Parallel and concurrent methods;


The generational collection used can manage the entire GC heap independently without cooperating with other collectors;


Spatial integration: On the whole, G1 uses a 'mark-organize' algorithm, but partially it is based on a 'copy' algorithm. But in any case, both algorithms mean that the G1 algorithm will not generate memory space fragmentation, and can provide regular available memory after collection.


Operation steps: initial marking; concurrent marking; final marking; screening and recycling.

Remarks:

Concurrency: The garbage collection thread can be executed at the same time as the user thread

Parallel: There can be multiple garbage collection threads, but the user thread at this time is still in a waiting state.


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn