本文介绍了-XX:OnOutOfMemoryError 对 java.lang.OutOfMemoryError 不起作用:无法创建新的本机线程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 -XX:OnOutOfMemoryError=\"kill -9 %p\".它适用于大多数内存不足的情况,但它不会终止 java.lang.OutOfMemoryError 的进程:无法创建新的本机线程.

I use -XX:OnOutOfMemoryError=\"kill -9 %p\". It works for most of out of memory cases, but it doesn't kill the process for java.lang.OutOfMemoryError: unable to create new native thread.

推荐答案

很可能系统无法处理更多线程.不幸的是,这也意味着不能创建新进程 - 但 kill 命令将作为新进程运行!一个相当不愉快的Catch-22...

It may well be that the system cannot handle any more threads. That, unfortunately, would also mean that no new processes can be created - but the kill command would run as a new process! A rather unpleasant Catch-22...

这篇关于-XX:OnOutOfMemoryError 对 java.lang.OutOfMemoryError 不起作用:无法创建新的本机线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 05:06
查看更多