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.