申请失败(make Killed)

application failed (make Killed)

我已经通过 make 文件编译了我的 cpp 文件。我也通过这个 make 文件 运行 我的文件。

这个多线程应用程序也使用了 99% 的 CPU。我正在使用 Ubuntu 16.04.1 LTS 作为我的 OS。

在 运行ning 三天后,我意识到应用程序突然停止了,我在终端上看到了这个意外的错误消息。

Makefile:: recipe for target 'myMain' failed
make: *** myMain Killed

没有其他错误信息。此应用程序失败,没有异常错误消息。尽管没有人编写完整的证明应用程序,但我对我编写的程序(关于失败)非常自信。

我也从来没见过make: *** something Killed的留言

不幸的是,这种情况我不能轻易地一次又一次地重复以找出问题所在。

我想知道 make 应用程序或 Ubuntu 是否有任何机制可以在 运行 长时间占用大量资源的情况下终止任何应用程序?

更新

感谢用户 Basile Starynkevitch,这是我从 dmesg:

收到的结果
[351059.556308] Out of memory: Kill process 2794 (main) score 882 or sacrifice child
[351059.556318] Killed process 2794 (main) total-vm:30432908kB, anon-rss:13530324kB, file-rss:0kB

您的程序很可能是 Linux 内核 OOM Killer. See also this question and answers 的受害者。

Out of memory: Kill process

很可能您正在以用户身份编译源代码,并且您的环境受到 ulimit -a 命令列出的资源限制(内存或进程数)的限制。一旦达到硬限制,进程就会被 Linux 内核终止。

如果你有足够的内存,可以增加这些限制(ulimit -Sv),否则你需要增加你的机器内存或添加一些extra swap space

有关此行为的更多详细信息,请参阅:Kernel - Out Of Memory Management

When the machine is low on memory, old page frames will be reclaimed, but despite reclaiming pages is may find that it was unable to free enough pages to satisfy a request even when scanning at highest priority. If it does fail to free page frames, out_of_memory() is called to see if the system is out of memory and needs to kill a process.