Subject: Re: Increasing per-process memory limits
To: Gan Uesli Starling <alias@starling.us>
From: Jeremy C. Reed <reed@reedmedia.net>
List: netbsd-help
Date: 09/29/2004 12:43:59
On Wed, 29 Sep 2004, Gan Uesli Starling wrote:

> I upgraded my NetBSD machine 'baal' with a new CPU, motherboard
> and RAM. With 4GB now available, how do I increase my per-process
> memory limits.

A few different ways. (I don't know which you need or which apply.)

1) "sysctl proc" will show you your current process limits. You can use set
the limits by first getting the PID.

sysctl -w proc.PID.rlimit.memoryuse.soft=BYTES
sysctl -w proc.PID.rlimit.datasize.soft=BYTES
sysctl -w proc.PID.rlimit.stacksize.soft=BYTES
sysctl -w proc.PID.rlimit.memorylocked.soft=BYTES

See sysctl(3) manpage (although you can't search by terms above).

2) Use login.conf classes. See login.conf(5) man page.
You can define the datasize, memorylocked, memoryuse, stacksize and other
attributes.

For example, my /etc/login.conf has:

default:maxproc=200:

(You could have a different name and also use it in the master.passwd for
the login class entry.)

3) Use your shell's limit/ulimit commands to increase.

4) Maybe define in a kernel configuration:

options DFLDSIZ=BYTES # place amount of datasize soft limit bytes here
options DFLSSIZ=BYTES # stack size soft limit

But I don't know about kernel and maximum size of resident set size or
mlock.

I don't know how the limits are automatically set based on physical
memory. It would be good if there was some automatic way for it to adjust
(at boot time) based on the physical memory. (Maybe it does? Where? Anyone
know?)

 Jeremy C. Reed

 	  	 	 BSD News, BSD tutorials, BSD links
	  	 	 http://www.bsdnewsletter.com/