8

I'd like to know what are the experiences with G1 garbage collector in newest JDK? I see NullPointerException thrown in my program, although code didn't change and behave correctly in earlier JDKs.

Aditya W
  • 652
  • 8
  • 20
Roman Kagan
  • 10,440
  • 26
  • 86
  • 126
  • Remember that it is an experimental feature so problems are to be expected. – Mark Jun 12 '09 at 14:41
  • 4
    Can you provide a code sample? There's a chance that you've exposed a timing / concurrency problem with the new collector. – Bob Cross Jun 12 '09 at 14:41
  • I received random OutOfMemoryError exceptions mostly on array allocations. With normal GC, no problems occurrs. – akarnokd Jun 12 '09 at 15:45
  • I would try -XX:MaxPermSize=512m option, or some other things, before resorting to the new garbage collector. – djangofan Jul 31 '09 at 15:12
  • I tried to run Netbeans with G1. Several errors kept occuring from time to time. So switched back to normal GC. – java.is.for.desktop Oct 27 '09 at 00:29
  • Have a look at : http://stackoverflow.com/questions/8111310/java-7-jdk-7-garbage-collection-and-documentation/34254605#34254605 – Ravindra babu Feb 21 '16 at 09:51

3 Answers3

3

A garbage collector will only impact the performance of your application, not its correctness. I've been using it for Eclipse, just for fun, and seemed stable.

I would look elsewhere for the source of the exceptions.

Robert Munteanu
  • 67,031
  • 36
  • 206
  • 278
  • 10
    A bug in garbage collector, on the other hand, *can* impact its correctness. Something about "experimental" tells me it's not completely unreasonable to question the situation. :) – Sam Harwell Aug 18 '09 at 06:54
  • 2
    I agree that it is experimental and I would not use it production, at least not with u14. – Robert Munteanu Aug 18 '09 at 07:12
2

I've been running jEdit using:

-Xmx192M -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC

for the last couple of days on windows. Haven't experienced anything going wrong or misbehaving.

I also tried running Intellij using the G1 GC, it didn't fair so well. It lasted a couple of hours before crashing in a big pile of mess, a bit optimistic maybe.

Gareth Davis
  • 27,701
  • 12
  • 73
  • 106
1

I tried and experienced no exceptions. But performance of our server dropped about 30%.

Vitaly
  • 1,081
  • 2
  • 9
  • 14
  • 1
    That's disappointing that you saw such a significant performance degradation, but it's important to remember that an important goal of the G1 collector is to minimize pauses. With a heap of a few GB or higher, you can get multiple minute pauses when GC runs with the other collectors. So, even if G1 leads to somewhat longer response times, as long as they are more consistent and never exhibit the worst-case behavior, that would be a great improvement for some apps. – Matt Passell Aug 25 '09 at 03:12
  • 1
    you should post all your VM options for us here so that we can compare with your "30% drop analysis". – djangofan Nov 03 '10 at 18:09