我比较好奇这个问题,尽管我知道JVM
现在已经非常稳定,但还是止不住这样问:
Java
,如何编写一个程序使Java
虚拟机崩溃?其次,如果用其他任何运行在JVM
上的语言,比如JRuby
、Clojure
等,如何编写一个程序使JVM
崩溃?
至于提到的JVM,可以是任何平台上的,比如Windows、Linux或任何UNIX。
高洛峰2017-04-17 11:20:04
The poster can take a look at this: http://stackoverflow.com/questions/65200/how-do-you-crash-a-jvm
PHPz2017-04-17 11:20:04
You need to explain what you mean by "crash": does it mean running out of resources of the machine, triggering an exception that is not allowed by the system, triggering a design error in the JVM, or something else. The concept of "collapse" is still very broad. ——When resources are exhausted, no matter what language there is, there is a universal solution: calling several empty functions in a loop, causing the system's recursive stack to explode, which is called stack overflow. To trigger an exception that is not allowed by the system, just access the memory that is not within the application of your own program, which is a segmentation fault. But I believe that these two answers are probably not what you are expecting.
高洛峰2017-04-17 11:20:04
http://rednaxelafx.iteye.com/blog/460893
http://rednaxelafx.iteye.com/blog/461787
Let me take a look at these two. Although the title is <If you want to make the CLR hang up...>, it also comes down to the JVM.