Skip to content
Tags

,

Java 8 Garbage Collectors

August 23, 2013

What’s new in Java 8?

Two things have been done in Java 8 that affect garbage collection:

  • JEP 122 – Remove Permanent Generation — The motivation for this was to begin to converge HotSpot (HotSpot7 and previous had PermGen) and JRockit (never had PermGen) JVMs. The PermGen-less implementation will store Class metadata in native memory while interned Strings and statics will be moved to heap space.
  • JEP 173 – Retire Some Low Value GC Combinations — 3 combinations will be deprecated and not tested.
    • DefNew+CMS: ParNew+CMS will be better.
    • ParNew+SerialOld: ParallelScavenge+SerialOld will be better.
    • iCMS (incremental): Normal CMS will be better.

G1 Garbage Collector

G1 is planned to be the long-term replacement for the CMS GC. The tutorial below provides all the information you could want about the G1 (“garbage first”) GC. It takes about 1 hour to go through the tutorial.

Getting Started with G1 GC – has a great explanation with various illustrations of the GC’s operation.

Concurrent Mark Sweep (CMS) Collector

Also known as the low latency collection. This is 1 of 2 non-compacting collector. Activated by “-XX:+UseConcMarkSweepGC”

Parallel Compacting Collector

Young and old generation are both collected in parallel and compacted. Activated with “-XX:+UseParallelOldGC”

Parallel Collector

Collects new in parallel, but old by serial algorithm. Activated by “-XX:+UseParallelGC”

Serial Collector

Single CPU collector for both young and old generations. Good for embedded systems without a lot of processing power. By default ergonomics does not use this unless you have less than 2 processors and less than 2GB of memory. Activated by “-XX:+UseSerialGC”

Useful Resources

Memory Management in Java HotSpot VM (April 2006) PDF

Java HotSpot at a Glance page

Java HotSpot Garbage Collection Docs

Java 6 GC Tuning

Java Tuning White Paper

Java HotSpot VM Options

HotSpot Ergonomics – detects type of machine and makes sensible default assumptions.

Advertisements

From → Java

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: