PDA

View Full Version : [all variants] Is there any way to limit the memory a process can use?


rivasdiaz
May 2nd, 2008, 12:41 PM
I need to limit the memory a process can use. I need it 'cause I need to access a web site that only works with IE so I have installed IE under wine, but in some occasions the wineserver takes all my memory and the whole system becomes irresponsible. So I need a way to say that I want wineserver to be under 512MB of RAM, and to get "out of memory" errors after that. I have found ulimit but it seems that it will limit the RAM for all the processes of a user, which I do not want. I want protection from a process, not from a user.

Is there any way I can achieve that? Can I limit "ulimit" work on some processes? Can I do what I need with other command?

Thanks in advance,
Rivas

movieman
May 2nd, 2008, 12:56 PM
I believe ulimit limits the usage of the shell and any process it starts. So if you create a shell script like:

#!/bin/bash
ulimit {whatever}
/usr/local/bin/my_program

and use that to start your program, I think it should work.