Every now and again a process or program goes hog wild and chews up
all the resources on a Linux machine.

Its the usual thing, a memory leak or something. Shouldn't happen but
it does.


Unfortunately modern Linux distributions have an attitude that the
user is all glorious and knows what he is doing and should be allowed
all resources he possesses.

Thus a memory leak can chew up all available ram, all available
virtual ram and never let go.

Then Linux's dread, and somewhat arbitary, OOM Killer (Out Of Memory
killer) wakes up and starts clobbering random processes. Usually the
wrong ones.

A better administrated box sets ulimit's on resources so that
processes that are go wild get clobbered.

Here is a set of ulimits you can put in your own ~/.bash_profile to
stop the rampage.

Comments, suggestions, tweaks welcome.

# This is the critical one. Tweak this to be a bit less than your physical RAM.
#virtual memory        (kbytes, -v) 500000
ulimit -v 500000


# This tends to drop 'core' files when ever _anything_ seg faults.
# How ever, you can then fire up gdb and see why it died.

#core file size        (blocks, -c) ulimit -c 40000

#data seg size         (kbytes, -d) 500000
ulimit -d 500000

# file size             (blocks, -f) unlimited
#ulimit -f

#max locked memory     (kbytes, -l) unlimited
ulimit -l 100000

#max memory size       (kbytes, -m) 400000
ulimit -m 400000

#open files                    (-n) 200
#ulimit -n 200

#pipe size          (512 bytes, -p) 8
#ulimit -

#stack size            (kbytes, -s) 8192
#ulimit -

#cpu time             (seconds, -t) unlimited
#ulimit -

#max user processes            (-u) ulimit -u 160






John Carter                             Phone : (64)(3) 358 6639
Tait Electronics                        Fax   : (64)(3) 359 4632
PO Box 1645 Christchurch                Email : [EMAIL PROTECTED]
New Zealand

Carter's Clarification of Murphy's Law.

"Things only ever go right so that they may go more spectacularly wrong later."

From this principle, all of life and physics may be deduced.

Reply via email to