If you are using linux I would recommend using ulimit to set memory limits. Your computer would be safe from this and other problems.
http://www.linuxhowtos.org/Tips%20and%20Tricks/ulimit.htmHope this helps.
There should also be a way to do this in Windows. Maybe someone else can chime in to help you out.