Syntax: ulimit [-acdfHlmnpsStuv] [limit]
Description: The shell contains a built-in command to limit file sizes, ulimit, which can also be used to display limitations on system resources
A second method for limiting the potential impact of runaway processes is to set limits on a per process basis. This can be achieved by setting the ulimit command in /etc/profile.
To set a soft limit on the maximum amount of memory available to a given process to a value that is less than the total amount of memory on the system on a system with 1 gig of real memory and 500 megs of virtual memory you would set the following values in /etc/profile:
ulimit -S -m 1000000
ulimit -S -v 500000
With this value set, the system will kill any process that tries to take up more resources than you have set as a limit.
cindy:~> ulimit -a
core file size (blocks)0
data seg size (kbytes) unlimited
file size (blocks) unlimited
max locked memory (kbytes) unlimited
max memory size (kbytes) unlimited
open files 1024
pipe size (512 bytes) 8
stack size (kbytes) 8192
cpu time (seconds) unlimited
max user processes 512
virtual memory (kbytes) unlimited
Cindy is not a developer and doesn't care about core dumps, which contain debugging information on a program. If you do want core dumps, you can set their size using the ulimit command. Read the Info pages on bash for a detailed explanation.