Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a closed source software with some memory leaks problems. Is there a tool or solution to "sandboxe" processes in a fixed amount of memory without using "ulimit" (to generic, I need a per-application memory control)

share|improve this question
up vote 3 down vote accepted

'ulimit' is a 'per-application' control… per process in fact. The ulimit shell command is a shell built-in setting the limit for the shell process and its children. Put the 'ulimit' command in the script starting your application and the limit will be set for this application only.

share|improve this answer
As Jacek said, that's what ulimit's for. If a binary application, you could wrap it in a script. – Warner Mar 3 '10 at 14:06

You could use a process management daemon like monit to monitor the amount of memory in use by your proceses and restart it when it grows over your defined limit.

This does sound drastic, but given your application is known to leak, restarting it regularly based on its usage is just putting off the inevitable, when the process size grows larger than the smaller of, your machines physical memory, or any address space limitations imposed by your operating system.

share|improve this answer

Use cgroups.

Note the difference between memory.limit_in_bytes and memory.memsw.limit_in_bytes. Also note memory.soft_limit_in_bytes.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.