5

Normally this can be accomplished by "ulimit -m" but on Linux (at least on Centos5) "man bash" says "-m The maximum resident set size (has no effect on Linux)".

So since "ulimit -m" has no effect on Linux is there another way to limit the resident set size per user?

Thanks in advance for any help.

HopelessN00b
  • 53,385
  • 32
  • 133
  • 208
  • 2
    Possible duplicate of [Cgroups, limit memory per user](https://serverfault.com/questions/719994/cgroups-limit-memory-per-user) – poige Jan 05 '19 at 18:40

2 Answers2

2

Limiting the total vmem size (-v) is probably what you want.

pjc50
  • 1,720
  • 10
  • 12
  • Thanks but we actually want to limit the resident set size, not the virtual memory size. –  Oct 01 '09 at 21:31
  • 3
    Well .. you can't, according to the documentation; the kernel ignores it. Why do you want to do this, and what behaviour do you expect when processes go over their RSS limit? – pjc50 Oct 02 '09 at 14:43
1

ulimit -m never limited RSS per user.

In the past (Linux 2.4.x, x < 30), ulimit -m affected the RSS per process. And even then, it was advice to the memory manager, not a hard limit. (See the RLIMIT_RSS section of man setrlimit.)

Similarly, ulimit -v does not impose per user limits. It imposes per process limits.

If you want to impose per user limits on Linux, I recommend considering cgroups.

mpb
  • 223
  • 2
  • 8