Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Apr 2005 16:29:05 -0400
From:      Chuck Swiger <cswiger@mac.com>
To:        David Grochowski <dgrochow@elvis.rowan.edu>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Limiting process memory consumption with rsetlimit and limit. . .
Message-ID:  <42641891.3090205@mac.com>
In-Reply-To: <Pine.GSO.4.44.0504170312480.14839-100000@elvis.rowan.edu>
References:  <Pine.GSO.4.44.0504170312480.14839-100000@elvis.rowan.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
David Grochowski wrote:
> I'm currently working on a project where I need to limit the amount of
> physical memory a process uses.  I've tried the rsetlimit function and the
> limit shell command to do so, but I have had no luck (though I was able to
> limit the virtual memory and cause it to segfault).  Neither seems to have
> any effect on the physical memory available to the process.  If anyone
> could enlighten me on how to limit the physical memory available to a
> process, it would be greatly appreciated.

setrlimit(RLIMIT_RSS, ...) in C or something like:

8-sec# limit memoryuse 10
9-sec# limit
cputime         unlimited
filesize        unlimited
datasize        500MB
stacksize       64MB
coredumpsize    100MB
memoryuse       10MB
memorylocked    unlimited
maxproc         256
descriptors     512
sockbufsize     unlimited
vmemorysize     unlimited

This is zsh, other shells may have slightly different syntax.
In /bin/sh: "ulimit -Sm 10240"?

-- 
-Chuck



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?42641891.3090205>