什么时候在java中使用垃圾收集器? [英] When is garbage collector used in java?

查看:128
本文介绍了什么时候在java中使用垃圾收集器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我所知只有当JVM需要更多内存时才使用GC,但我不确定。所以,有人建议这个问题的答案。

解决方案

Java的垃圾收集算法据我所知,非常复杂而不是那么简单。此外,还有更多可用于GC的算法,可以在VM启动时使用传递给JVM的参数进行选择。



有关垃圾回收的常见问题解答:< a href =http://www.oracle.com/technetwork/java/faq-140837.html =nofollow> http://www.oracle.com/technetwork/java/faq-140837.html <甲骨文还发表了一篇文章使用5.0 Java虚拟机调优垃圾收集,其中包含对垃圾收集的深入洞察,并且可能会对您更好地理解此事: http://www.oracle.com /technetwork/java/gc-tuning-5-138395.html


As far as I know GC is used only when JVM needs more memory, but I'm not sure about it. So, please, someone suggest an answer to this question.

解决方案

The garbage collection algorithm of Java is as I understand, pretty complex and not as straightforward. Also, there is more than algorithm available for GC, which can be chosen at VM launchtime with an argument passed to the JVM.

There's a FAQ about garbage collection here: http://www.oracle.com/technetwork/java/faq-140837.html

Oracle has also published an article "Tuning Garbage Collection with the 5.0 Java[tm] Virtual Machine" which contains deep insights into garbage collection, and will probably help you understand the matter better: http://www.oracle.com/technetwork/java/gc-tuning-5-138395.html

这篇关于什么时候在java中使用垃圾收集器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆