0

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.

  • Welcome to Unix Stackexchange! You can learn How to Ask a good question. That makes it easier for us to help you. – Stephen Rauch Jan 30 '17 at 19:35
  • @StephenRauch i have made a edit to match the pointers hope this is good please let me know if it still needs improving thank you in advance. – EVX Jan 30 '17 at 19:42
  • Define "handle". – Kusalananda Jan 30 '17 at 20:00
  • @Kusalananda Automating the handling of a memory hogging process in the efforts of not having system lag or freeze thanks to a browser. Best practice surrounding this topic. to script it or if there is some kind of process management tool that you can tell to monitor this and act according to rules or with use of built in commands, like nice/renice – EVX Jan 30 '17 at 20:14
  • @EVX Renicing a process will not make it return memory to the system. – Kusalananda Jan 30 '17 at 20:19
0

You should look into the Priority and Nice values of the process ID which is associated with the browsers process(es). Then you can always perform a renice of the nice value so that the browsers process(es) do not take up so many resources on your system.

  • Renicing a process will not make it return memory to the system. – Kusalananda Jan 30 '17 at 20:19
  • @Kusalananda i have updated the question. – EVX Jan 30 '17 at 20:41
  • @weaponG Thank you for the comment it might have not been what i was exactly after but still helpful information. – EVX Feb 1 '17 at 16:25
0

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.

  • 4
    Even if just a one-liner, mind sharing it? – phk Jan 31 '17 at 22:09
  • Please don't add "thank you" as an answer. Instead, accept the answer that you found most helpful. - From Review – Satō Katsura Feb 1 '17 at 3:21
  • @SatoKatsura Please note that i had to write thank you until i could accept my own answer as there is a time limit. Also to others please write a comment instead of giving it a bad vote seems like a poor choice when asking someone to share information. PS: made edits with a form of solution. – EVX Feb 1 '17 at 16:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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