This question already has an answer here:

I have 6GB RAM and 10GB swap. Some applications dare to consume/allocate/use about 5GB to 6GB of RAM.

When the memory completely fills out, the whole system hangs for 1 to 2 minutes to swap all inactive (and active) appplications, what is really troublesome because to access again some simple applications that consume less than 100MB, I have to wait about 10s to it be put on RAM again (well, all that is how I see it works out of my usage experience).

So, my goal is: put that single application under leash, restrict it to keep the whole system fast and stable.

marked as duplicate by xhienne, Scott, Stephen Rauch, Rui F Ribeiro, Romeo Ninov Aug 22 '17 at 5:59

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • A memory ulimit is out of the question? – Jeff Schaller Aug 21 '17 at 23:47
  • @JeffSchaller yes, I think the deal is to limit the RAM usage, and make such hungry application go to swap before all others, so I would give to that application only 2GB of RAM and everything else of it would go to swap. – Aquarius Power Aug 22 '17 at 17:57
  • yes, it has to do with swapiness, but in a sense that it must swap anything beyond 2GB of RAM (and not just be more likely to swap). The question there is not how I would ask it, but the answer there, about memory cgroup limit seems to be the way to go, thx! – Aquarius Power Aug 22 '17 at 17:59