gpt4 book ai didi

java - 无法运行程序 "ping": CreateProcess error=8

转载 作者:行者123 更新时间:2023-12-01 12:45:35 25 4
gpt4 key购买 nike

在我的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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com