Why ulimit can't limit resident memory successfully and how?

前端 未结 2 1552
面向向阳花
面向向阳花 2021-02-13 20:46

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
schedu         


        
相关标签:
2条回答
  • 2021-02-13 20:52

    According to the man page for setrlimit:

    RLIMIT_RSS

    Specifies the limit (in pages) of the process's resident set (the number of virtual pages resident in RAM). This limit only has effect in Linux 2.4.x, x < 30, and there only affects calls to madvise(2) specifying MADV_WILLNEED

    You probably want to set the virtual memory size instead, via ulimit -v

    0 讨论(0)
  • 2021-02-13 20:52

    You can restrict the resident memory using cgroups. See Resident Set Size (RSS) limit has no effect

    0 讨论(0)
提交回复
热议问题