根据我在Sun内存管理白皮书中的阅读:
When stop-the-world garbage collection is performed, execution of the application is completely
suspended during the collection
如果垃圾收集器在运行时发生了请求,应用程序会如何处理呢?如果垃圾收集器时间太长,应用程序会抛出异常吗?我尚未遇到此类问题,但想知道是否可能,并将引发哪种异常?
根据我在Sun内存管理白皮书中的阅读:
When stop-the-world garbage collection is performed, execution of the application is completely
suspended during the collection
如果垃圾收集器在运行时发生了请求,应用程序会如何处理呢?如果垃圾收集器时间太长,应用程序会抛出异常吗?我尚未遇到此类问题,但想知道是否可能,并将引发哪种异常?
这个垃圾回收器已经不再使用,被更好的垃圾回收器所取代。
stop-the-world
垃圾回收器会真正停止整个应用程序(所有线程),并清理堆。
当垃圾回收器需要太长时间(几乎从不发生)时,会抛出一个 Error
。
网络套接字上的传入流量会在回收器运行期间进行缓冲。
OutOfMemoryError
。 - Uwe PlonusOutOfMemoryError
,并非由于堆空间耗尽引起的,例如java.lang.OutOfMemoryError: GC overhead limit exceeded.
如果Java 7的默认垃圾收集器花费太多时间,则会抛出此异常。 - Uwe Plonus