3

I'm new to Linux and Terminal (or whatever kind of command prompt it uses), and I want to control the amount of RAM a process can use. I already looked for hours to find an easy-t-use guide. I have a few requirements for limiting it:

  1. Multiple instances of the program will be running, but I only want to limit some of the instances.
  2. I do not want the process to crash once it exceeds the limit. I want it to use HDD page swap.
  3. The program will run under WINE, and is a .exe.

So can somebody please help with the command to limit the RAM usage on a process in Linux?

2
  • See this: unix.stackexchange.com/questions/44985/… Commented Jul 4, 2013 at 0:18
  • I have already looked at that source many times, and it is not useful since it does not give the full code after "$pdftoppm". Commented Jul 4, 2013 at 11:20

1 Answer 1

2

The fact that you’re using Wine makes no difference in this particular context, which leaves requirements 1 and 2. Requirement 2 –

I do not want the process to crash once it exceeds the limit. I want it to use HDD page swap.

– is known as limiting the resident set size or rss of the process, and it’s actually rather nontrivial to do on Linux, as is demonstrated by a question asked in 2010. You’ll need to set up Linux control groups (cgroups). Fortunately, Justin L.’s answer gives a brief rundown on how to do so. Note that

  • instead of jlebar, you should use your own Unix user name, and
  • instead of your/program, you should use wine /path/to/Windows/program.exe.

Using cgroups will also satisfy your other requirements – you can start as many instances of the program as you wish, but only those which you start with cgexec -g memory:limited will be limited.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.