为什么ulimit无法成功限制常驻内存,怎么办? [英] Why ulimit can't limit resident memory successfully and how?
本文介绍了为什么ulimit无法成功限制常驻内存,怎么办?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我启动一个新的bash shell,然后执行:
I start a new bash shell, and execute:
ulimit -m 102400
ulimit -a
"
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 20
file size (blocks, -f) unlimited
pending signals (-i) 16382
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) 102400
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) unlimited
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
"
然后,我执行编译一个大项目.链接将使用更大的内存,超过2G.结果,进程ld使用了2G以上的常驻内存.
and then ,I execute compiling a huge project. the Linking of it will use large memory, more then 2G. The result, process ld used more then 2G resident memory.
有什么不对吗?如何使用ulimit或可以使用其他程序来限制常驻内存?
is there any wrong ? how to use ulimit or can I use other programs to limit resident memory?
限制驻留内存的目标,是因为当一个进程几乎用完所有内存时,计算机将冻结.
the target of limit resident memory, is because computer will freeze when one process almost used all memory.
推荐答案
查看全文