I wrote a script that I had to optimize because it used to much memory. It ran out of memory on a machine with 1GB RAM and 2GB swap :) The message was : "Killed, out of Memory". The kernel (Linux) killed it, so it was absolutely impossible to manage the problem from within the script I guess.