简体   繁体   English

Java应用程序中的垃圾回收

[英]Garbage Collection in Java application

I've searched a lot on how to configure the garbage collector in a Java application, but found answers on GC tuning and using some -XX arguments. 我搜索了很多有关如何在Java应用程序中配置垃圾收集器的信息,但是找到了有关GC调整和使用一些-XX参数的答案。

There is also no information on where to use these -XX arguments in Java app. 也没有有关Java应用程序中在何处使用这些-XX参数的信息。

How do I configure this? 我该如何配置?

The simple answer is that if you don't need to tune your GC's performance, you don't need to specify any GC options at all. 简单的答案是,如果您不需要调整GC的性能,则根本不需要指定任何GC选项。

The Java JVM is capable of adjusting the GC's behavior reasonably well to meet the runtime needs of typical Java applications. Java JVM能够合理地调整GC的行为,以满足典型Java应用程序的运行时需求。 If it is doing a good job, you don't need any GC options at all. 如果做得不错,则根本不需要任何GC选项。 If not, then 1 you tune the GC 如果不是,则1调整GC

Indeed, I would say that (with the possible exception of -Xmx ) all GC related JVM options are GC tuning options. 确实,我想说(可能是-Xmx例外),所有与GC相关的JVM选项都是GC 调整选项。 So the (Oracle or Android or ... pick your vendor) documentation on Java GC tuning is precisely where you should start looking for advice on GC options. 因此,关于Java GC调优的(Oracle或Android或…选择您的供应商)文档正是您应该开始寻找有关GC选项的建议的地方。


1 - And not before! 1-之前没有!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM