在我的java代码中,我在启动时使用了new ProcessBuilder("ping", strIP);
,它运行正常,但是24小时后,它会崩溃,显示
Cannot run program "ping": CreateProcess error=8 There is insufficient memory for the Java Runtime Environment to continue. Native memory allocation (malloc) failed to allocate 32744 bytes for ChunkPool :allocate
我不知道如何解决它。
最佳答案
如果您不终止进程,Ping 进程就永远不会停止。
ProcessBuilder pb = new ProcessBuilder("ping", strIP);
Process process = pb.start(); //this will keep running and probably why you get insufficient memory after a long time
... //do whatever you need
process.destroy(); //stop the ping process
关于java - 无法运行程序 "ping": CreateProcess error=8,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24728580/