Possible Duplicate:
Java garbage collector - When does it collect?
当人们说 Java 中的垃圾收集器降低了整个应用程序的速度时,他们真正的意思是什么?垃圾收集器不是只有在对象被释放时才会触发吗?请帮助我理解。谢谢!
最佳答案
看看http://developers.sun.com/mobility/midp/articles/garbage/
As Java technology becomes more and more pervasive in the telecommunications (telco) industry, understanding the behavior of the garbage collector becomes more important. Typically, telco applications are near-real-time applications. Delays measured in milliseconds are not usually a problem, but delays of hundreds of milliseconds, let alone seconds, can spell trouble for applications of this kind. Quite simply, sub-optimal performance translates directly into loss of revenue.
基本上,如果垃圾收集器压缩一个小堆,那么延迟很短,但如果您生成了大量垃圾,并且有一个很大的可到达对象图,您就会看到很大的延迟。新的垃圾收集算法(分代/增量 GC)在一定程度上缓解了这一问题,但调整 GC 仍然有些玄学。
关于Java垃圾收集器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6078929/