My software runs a command that looks something like:
find | xargs do a potentially memory hungry job
The problem is that sometimes a potentially memory hungry job gets too hungry, the system gets unresponsive and I have to reboot it. My understanding is that it happens due to the memory allocation over commitment. What I would like to happen is that if a job spawned by xargs wants more memory than is available, it dies (I am OK with it) and that is it. I guess I can get this behavior if I turn off overcommitment system-wide, but it is not an option. Is it possible to turn it off for a process?
A possible solution I was thinking of was to set
ulimit -v RAM size
But something tells me it is not a good idea.