“ulimit -m”在(现代)Linux 上不起作用吗?

Fli*_*mzy 13 linux memory resources ulimit

本文声称该-m标志ulimit在现代 Linux 中没有任何作用。我找不到其他任何东西来证实这一说法。它准确吗?

您可以尝试通过设置最大驻留集大小 (ulimit -m) 来限制进程的内存使用。这对 Linux 没有影响。man setrlimit 说它曾经只适用于古代版本。您应该限制最大虚拟内存量 (ulimit -v)。

如果它确实在旧版本的 Linux 中工作,那么哪个版本停止支持它?

Cri*_*itu 16

它在文章中说:

这对 Linux 没有影响。man setrlimit 说它曾经只适用于古代版本。

了setrlimit手册页说:

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

所以它在2.4.30停止工作。在为2.4.30更新日志说,有关这一点:

Marcelo Tosatti:
o Ake Sandgren:修复 RLIMIT_RSS madvise 计算错误
o Hugh Dickins:从 madvise 中删除 rlim_rss 和此 RLIMIT_RSS 代码。大概是代码误输入了