Is Chrome on Mac Trashing 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!

6 Comments Add yours

  1. Leighton Quarles says:

    Thanks for posting this. Really helped my old 2010 MacBook Pro keep its head above water.

    Like

    1. rossbrunson says:

      No problem, Brother. I found elements of this online and just tailored it nicely for my needs.

      Like

  2. Cory says:

    1) Do you mean *Lynx*, the terminal mode browser?

    2) 100-250open tabs? This isn’t a smart person with a solution, this is a person who has never learned to use and organise their bookmarks menubar, or learned to use Pocket and organise with tags, or some other way that would be beneficial in other contexts, too. I wonder how much time you waste trying to remember and find which of those 200 open tabs was the one you wanted?

    Like

    1. rossbrunson says:

      Cory, isn’t that a little negative and judgmental?

      I don’t mean Lynx (look up Links) and I am very organized. It so happens I use Sidewise for a tab manager, which offers hierarchical nested tab trees, hibernation of individual tabs or trees and it’s easy to search for tabs. Check it out, worthwhile.

      There are times when I have almost all my tabs hibernated and STILL Chrome is sucking up the processor and RAM with all the “Google Chrome Helpers.”

      I’m trying to help others, not just being critical.

      As I said on FB, given your background, we’d typically get along, as we do much the same things, so I am taking the time to explain what my intention was.

      Like

  3. Eric Rothweiler says:

    If you copy and paste and get weird errors – replace those #@$%^ `’ and other similar single quotes and backticks with a plain single quote stinking HTML renderer and OSX trying to decide which character I want because it can’t be what was originally input, can it?

    Thanks Ross! (from a guy with less tabs but still gets comments about “all of those open tabs!!”)

    Like

    1. rossbrunson says:

      Cool! I’ll look at replacing that, and I just got chastised, someone found an article by a guy, who I have now credite and feferenced, so apparently this was NOT from my coworker, he must have got it off the web…

      Like

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s