遭遇Out of memory: Kill process or sacrifice child

在调试一个爬虫程序时,发现一个非常奇怪的问题,程序总是在运行一段时候会被系统给Kill掉,在syslog里看到:

Nov 9 11:52:20 iZrj9iqn00z9x3jgz1v2t5Z kernel: [5542452.233851] Out of memory: Kill process 10526 (python3) score 738 or sacrifice child

服务器是1台2G内存的云服务器,内存不够?那就暂时使用虚拟内存扩充上来:
swapoff -a
dd if=/dev/zero of=swapfile bs=1024 count=4000000
mkswap swapfile
swapon swapfile

这样就临时加了4G虚拟内存上来,保证程序在峰值运行时不被kill。

参考:https://plumbr.io/blog/memory-leaks/out-of-memory-kill-process-or-sacrifice-child


已发布

分类

,

来自

评论

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注