see: http://stackoverflow.com/questions/2679330/catching-java-lang-outofmemoryerror
There are a number of scenarios where you may wish to catch an OutOfMemoryError and in my experience (on Windows and Solaris JVMs), only very infrequently is OutOfMemoryError the death-knell to a JVM.
There is only one good reason to catch an OutOfMemoryError and that is to close down gracefully, cleanly releasing resources and logging the reason for the failure best you can (if it is still possible to do so).
本文探讨了在Java应用中遇到OutOfMemoryError时的正确处理方式,包括资源释放、日志记录等,避免应用程序崩溃并提高系统稳定性。
2580

被折叠的 条评论
为什么被折叠?



