First of all hello, and thank you for taking the time to read my question.Update: What my desired outcome with this question is to know the best  way to handle a browser process using up all the memory via automation.  to return the memory via end of process or some other way if there is one.the process in question is browsers, i do a lot of research and have a lot of tabs open when i notice the lag starting to happen i have a few seconds to end the process to gain back the memory or the system will freeze.In spirit of not re-writing something that has already been made.I wanted to ask before i write a basic script to handle this.It also would be very interesting to know the best practice to handle this.Please let me know should you require further information from me to be able to answer this question.Thank you in advance.
How can i automatically handle hogging process before system freeze?
linux;shell script;scripting;process management
I'm not sure if this is the best practice but i got away with just creating a one-liner that checks if greater then 80% then end the process.[ $(free -m| grep  Mem | awk '{ print int($3/$2*100) }') -gt 80 ] && pkill application || echo Not Over 80%Please note that this one-liner is matched up from other points of code and still testing how it works but so far it has worked well for me. I Make no claims on how it might work for you but might be a good starting point.If someone has a better option i'm still eager to learn so please do share your knowledge.