你如何崩溃JVM? [英] How do you crash a JVM?

查看:123
本文介绍了你如何崩溃JVM?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在读一本关于编程技巧的书,其中作者问受访者:你如何崩溃JVM?我认为你可以通过写一个最终耗尽所有内存的无限for循环来做到这一点。

I was reading a book on programming skills wherein the author asks the interviewee, "How do you crash a JVM?" I thought that you could do so by writing an infinite for-loop that would eventually use up all the memory.

任何人有任何想法吗?

推荐答案

与单个答案最接近的是 System.exit(),它终止了JVM立即没有适当的清理。但除此之外,本机代码和资源耗尽是最可能的答案。或者,您可以查看Sun的错误跟踪器,查找您的JVM版本中的错误,其中一些允许可重复的崩溃方案。在32位版本下接近4 Gb内存限制时,我们常常会发生半常规崩溃(我们现在通常使用64位)。

The closest thing to a single "answer" is System.exit() which terminates the JVM immediately without proper cleanup. But apart from that, native code and resource exhaustion are the most likely answers. Alternatively you can go looking on Sun's bug tracker for bugs in your version of the JVM, some of which allow for repeatable crash scenarios. We used to get semi-regular crashes when approaching the 4 Gb memory limit under the 32-bit versions (we generally use 64-bit now).

这篇关于你如何崩溃JVM?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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