Chrome Eating Your System’s Resources?

What’s the Problem?

I’m a big Chrome user, I’ll admit it.  Likewise, I use Safari, Firefox, Vivaldi and sometimes (but rarely unless it’s a dangerous link) Links the text browser.  So what?

Note:  Readers have pointed out THIS article, which I was unaware of, so please give the credit for the base script to the author of the original script, which I thought came from a coworker. 

My version of Chrome usually has about 100-250 tabs open at any given time, it’s my Evernote, every tab is something I want to look at, need to see at some time, or a place for me to do work or get information from.

This causes a LOT of issues with system resources, and so I have taken to using a script that I got portions of online and did other parts of myself.

When Chrome gets out of hand

Chrome uses a set of Chrome Helper processes to do things like run Sidewise the tab manager, or FB Video Downloader, Tineye Image Search, all those lovely and helpful extensions that you get from the Google Chrome Extension store.

When you have too many of these, or just have been running Chrome for a number of hours or even days, the process table will very likely contain 10-100 instances of “Google Chrome Helper”, each with it’s own little bit of the processor and set of dedicated memory. This adds up, and makes your machine very sluggish and can cause system crashes.

Killgoog – the process serial killer

I called my script “killgoog.sh” and here it is:

#!/bin/bash

ps ux | \
grep ‘[C]hrome Helper –type=renderer’ | \
grep -v extension-process | \
tr -s ‘ ‘ | \
cut -d ‘ ‘ -f2 | \
xargs kill

This is a command line script that I placed in the /usr/local/bin directory, and set to be world-executable, or rwxr-xr-x, aka 755 in octal format.

When you put the script in this directory, which is in the path, and set it to executable like I have, you only need to open a shell, aka “Terminal.app” on the Mac and type “killgoog.sh” and hit Enter.

The script will scrub through the ps command’s output and find all instances of “Chrome Helper” “chrome Helper” etc. and pull out the processes’ PID (that’s what the “cut -d” line is doing and then feeds that set of arguments to the xargs command and thence to the kill command.

This works REMARKABLY well at killing all instances of Chrome Helpers, you’ll see a bunch of sad little faces on the top of your tabs in Chrome after this script kills all the helpers or tab contents.

The beauty of this is that your tabs are still pointing to the right page, they still have the same URL, they just are “dead” and not taking up active system resources!Hack Prize Chrome

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s