Java 7 (JDK 7) garbage collection and documentatio

2019-01-01 10:08发布

Java 7 has been out for a while now, but I cannot find any good resources on the configuration of the garbage collectors, specifically the new G1 collector.

My questions:

  1. Is G1 the default collector in Java 7 and if not how do I activate G1?
  2. What optional settings does g1 have in Java7?
  3. Were there any changes made to other collectors like cms or the parallel collector in Java 7?
  4. Where can I find good documentation on garbage collection in Java 7?

8条回答
浮光初槿花落
2楼-- · 2019-01-01 10:57

No G1 is not default garbage collector in jdk 1.7.0_02. The default garbage collector depends upon the class of machine. If the machine is of Server class then the default garbage collector is Throughput Collector. If the machine is of Client class then the default garbage collector is Serial Collector.

查看更多
与君花间醉酒
3楼-- · 2019-01-01 11:02

By default you don't really want to use G1 collector, as it is not really better than the others. It is only good for special purposes.

In low latency application is is sligthly better than CMS, as it has a little bit shorter, and more predictable pause times. In exchange the throughput is much worse than CMS in exchange.

So it is only good if the latency is important, but the throughput is not important at all. If both are important, then stay with CMS.

查看更多
登录 后发表回答