Experience with JDK 1.6.x G1 (“Garbage First”)

2019-04-06 10:37发布

问题:

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.

回答1:

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.



回答2:

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.



回答3:

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