I have an ubuntu system and I have a script that runs regularly. I need to limit the maximum amount of memory that this script can use. AFAIK
ulimit is the command to do this, however I can't get it to work.
For example I have the following script:
#! /bin/bash ulimit -m 1024 X="x" seq 100 | while read LINE ; do X="$X$X" done
This should make
$X grow in size, and this example is just the kind of thing I want to limit. However the ulimit call doesn't seem to work. I can run the script OK, and it doesn't die, and
top shows me that the script gets lots of memory. What am I doing wrong? How can I force this script to never user more than a certain amount of memory?