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

标签 java memory ping

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

相关文章:

java - 返回 true 或 false 或抛出异常

php - MySQL 数据库导出 : Allowed memory size of 67108864 bytes exhausted

python - 尝试读取大型网站文件数据时出现 MemoryError 异常

c# - header 检查 C# 总是 403?

java - 意外错误 : java. security.InvalidAlgorithmParameterException:trustAnchors 参数必须为非空

java - Android检测是否在设计模式下调用了构造函数?

c++ - 使用线程时的内存分配问题

PHP 如何在没有 system() 或 exec() 的情况下 ping 服务器

powershell - 当它不响应 ping 时通过 powershell 获取服务器的 IP

java - 两个Relativelayouts垂直显示