为什么没有OutOfMemoryError子类? [英] Why there are no OutOfMemoryError subclasses?

查看:213
本文介绍了为什么没有OutOfMemoryError子类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

众所周知, OutOfMEmoryError 有多种原因(见第一个答案)。为什么只有一个例外,涵盖所有这些情况,而不是从 OutOfMEmoryError 继承的多个细粒度的代码?

As we all know, there are multiple reasons of OutOfMEmoryError (see first answer). Why there is only one exception covering all these cases instead of multiple fine-grained ones inheriting from OutOfMEmoryError?

img src =https://yuml.me/diagram/dir:rl/class/%5BOutOfMemoryError%5D%0D,%20%5BOutOfMemoryError%5D%5E%5BOutOfHeapSpaceError%5D%0D,%20%5BOutOfMemoryError%5D%5E %5BOutOfPermGenSpaceError%5D%0D,%20%5BOutOfMemoryError%5D%5E%5BGcOverheadLimitExceededError%5D%0D,%20%5BOutOfMemoryError%5D%5E%5BUnableToCreateNativeThreadError%5Dalt =UML>

推荐答案

我会期望,因为你真的不能做任何事情,当发生这样的事情:几乎不要紧,为什么你跑出来,因为你无所事事。也许附加的信息会很好,但是...

I'd expect because you really can't do anything else when that happens: it almost doesn't matter WHY you ran out, since you're screwed regardless. Perhaps the additional info would be nice, but...

我知道tomcat试图做这个Out Of Memory Parachute的事情,他们在那里握着一大块内存并尝试发布它,但我不知道它的效果如何。

I know tomcat tries to do this "Out Of Memory Parachute" thing, where they hold onto a chunk of memory and try and release it, but I'm not sure how well it works.

这篇关于为什么没有OutOfMemoryError子类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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