[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [K12OSN] Limiting memory use



Todd O'Bryan wrote:

I'm using Ubuntu 6.10.

I teach programming and students will frequently create an infinitely
recursive function that eats up more and more memory. If they don't
realize what they've done and stop the program, eventually we run out of
RAM, start hitting the virtual memory, and the whole lab comes to a
grinding halt as the system thrashes itself to oblivion.

Is there any way to limit the memory that a process can suck up so that
this doesn't happen?

Thanks,
Todd

_______________________________________________
K12OSN mailing list
K12OSN redhat com
https://www.redhat.com/mailman/listinfo/k12osn
For more info see <http://www.k12os.org>
Take a look at ulimit

[timborn elliott ~]$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
file size               (blocks, -f) unlimited
pending signals                 (-i) 24574
max locked memory       (kbytes, -l) 32
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
stack size              (kbytes, -s) 10240
cpu time               (seconds, -t) unlimited
max user processes              (-u) 24574
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

You should be able to set system wide limits by adding a file in /etc/profile.d/ulimit.sh:

cat /etc/profile.d/ulimit.sh
ulimit -m 1024




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]