Re: [SLUG] Restricting a program to a fixed amount of memory.

From: Brett Simpson (simpsonb@hillsboroughcounty.org)
Date: Mon Jun 03 2002 - 18:01:57 EDT


Thanks a bunch.

>>> ronan@iotcorp.com 06/03/02 16:51 PM >>>
Brett Simpson wrote:
> I have a daemon "realserver" that likes to consume all available memory on the system despite using a config option to only use a fixed amount of memory. It even consumes the swap memory so the drive keeps quite busy. Normally this would be an issue for Real support to fix but they won't support 2.4.x kernels. Is there a way to force the daemon or any other program to only see a fixed amount of memory. For example lets say I have 256MB of ram but I only want a particular program to see 96MB.
>
> Brett

Run "ulimit" (a BASH built-in on Linux). This sets limits for the
current shell, and all children of that shell (i.e. your daemon).

ulimit -d 96000 -v 96000 -m 96000 ; realserver

options:
               -a All current limits are reported
               -c The maximum size of core files created
               -d The maximum size of a process's data segment
               -f The maximum size of files created by the
                      shell
               -l The maximum size that may be locked into
                      memory
               -m The maximum resident set size
               -n The maximum number of open file descriptors
                      (most systems do not allow this value to be
                      set)
               -p The pipe size in 512-byte blocks (this may
                      not be set)
               -s The maximum stack size
               -t The maximum amount of cpu time in seconds
               -u The maximum number of processes available to
                      a single user
               -v The maximum amount of virtual memory
                      available to the shell



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 20:19:23 EDT