6

Is the G1 garbage collector still considered experimental in recent versions of Java (6)? Is it safe and ready for production use?

EDIT: I am referring to Oracle JVM.

ruakh
  • 156,364
  • 23
  • 244
  • 282
Konrad Garus
  • 50,165
  • 42
  • 145
  • 220
  • Is this limited to just the 1.6 JVM? Java 7/1.7? (Java 6 isn't restricted to the Sun/Oracle JVM implementation.) –  Mar 13 '12 at 18:18
  • 1
    The G1 GC is specific to the Sun/Oracle JVMs, for both recent 6, and 7. – DNA Mar 13 '12 at 19:12
  • A key problem is that the G1 may not perform better than CMS depending on your application. IMHO, You can't beat reducing the amount of garbage you produce to improve performance, then the choice of GC becomes less important. – Peter Lawrey Mar 14 '12 at 09:30

2 Answers2

3

No as suggest this Oracle article, it's still experimental. It will replace CMS but it seems that it's not quite performant yet : Relative Performance of Java's Garbage First (G1) Garbage Collector?

EDIT :

So now the G1 is "fully supported" in JDK7u4, it not consider anymore as experimental, so I guess it's production ready! .

Community
  • 1
  • 1
alain.janinm
  • 19,035
  • 10
  • 56
  • 103
  • Note that the latest answers in that question are more than a year old. Are those still true? – Jesper Mar 13 '12 at 18:37
  • I don't really know don't made my own study :/ If Oracle documentation consider it as experimental it's probably still less efficient than CMS. It's the long term replacement. So until Oracle tells CMS is deprecated I think it's better to avoid G1. – alain.janinm Mar 13 '12 at 18:42
  • That's exactly why I ask. I saw those docs. They may be long outdated. – Konrad Garus Mar 13 '12 at 19:58
  • Measuring efficiency is quite relative to your application and the different JVM options you gave. If you make enough tests yourself to be sure that G1 is better then I don't see any reason to not use it. The oracle article I gave has been posted Fri, 16 Jul 2010. This question also provide good hints (2010)http://stackoverflow.com/questions/2254041/java-g1-garbage-collection-in-production. Lesser than 2 years I don't think it's already outdated. – alain.janinm Mar 13 '12 at 20:46
1

Java 6: Update 20.

Java 7: Primordial version has it.

By Oracle JVM, you mean Sun HotSpot? It might be confused with JRockit. Much preferred to call it HotSpot.

Oh Chin Boon
  • 21,393
  • 45
  • 133
  • 208