14

This article claims that the -m flag to ulimit does nothing in modern Linux. I can find nothing else to corroborate this claim. Is it accurate?

You may try to limit the memory usage of a process by setting the maximum resident set size (ulimit -m). This has no effect on Linux. man setrlimit says it used to work only in ancient versions. You should limit the maximum amount of virtual memory (ulimit -v) instead.

If it's true that it worked in older versions of Linux, which version stopped supporting this?

Flimzy
  • 478
  • 6
  • 22
  • Here's an interesting article which goes into some detail about the various limits and what they mean. It's ten years old but presumably most of this stuff doesn't change. http://answers.google.com/answers/threadview/id/311442.html – Dan Pritts Oct 06 '14 at 16:42
  • Related: [Limit memory usage for a single Linux process](http://unix.stackexchange.com/q/44985/1174) – Cristian Ciupitu Apr 29 '16 at 22:50

1 Answers1

17

It says right there in the article:

This has no effect on Linux. man setrlimit says it used to work only in ancient versions.

The setrlimit man page says:

 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.

So it stopped working in 2.4.30. The changelog for 2.4.30 says something about this:

Marcelo Tosatti:
o Ake Sandgren: Fix RLIMIT_RSS madvise calculation bug
o Hugh Dickins: remove rlim_rss and this RLIMIT_RSS code from madvise. Presumably the code crept in by mistake

Cristian Ciupitu
  • 2,430
  • 1
  • 22
  • 29