Skip to content

Instantly share code, notes, and snippets.

@Matooy
Last active February 3, 2021 07:29
Show Gist options
  • Save Matooy/e455793296ca046d10ba to your computer and use it in GitHub Desktop.
Save Matooy/e455793296ca046d10ba to your computer and use it in GitHub Desktop.
Limit "Google Chrome" background renderer process count.

Limit "Google Chrome" background renderer process count.

(for Mac OSX)

  1. Open "Automator"

  2. Create new Application.

  3. Select "Run Shell Script" from "Actions".

  4. Select your shell language (I selected '/bin/bash').

  5. Paste below command.

open "/Applications/Google Chrome.app/" --args --renderer-process-limit=1

  1. Voila!
@DwarfFighterCleric
Copy link

Hello, my friend, how are you? Do you happen to know it the --renderer-process-limit switch still works? On my current Chromium version I notice no change in behavior, still 9 "renderer" processes popping up at startup. Is there another switch to manually override the Chromium RAM detection to specify a lower memory usage? I'm having problems with sudden memory explosions being paged to swapfile.

@will-ca
Copy link

will-ca commented Apr 29, 2020

@DwarfFighterCleric

Using man chromium states that "Chromium has hundreds of undocumented command-line flags that are added and removed at the whim of the developers", which does seem to be true based on how they add and remove features without warning or public-facing documentation, so as a rule of thumb, it's probably best to not count on command-line flags sticking around.

However, both the master branch of the current source code and an officially linked page that seems to be automatically generated from it still include kRendererProcessLimit/"renderer-process-limit", so this particular flag does still seem to be around:

https://chromium.googlesource.com/chromium/src/+/refs/heads/master/content/public/common/content_switches.cc
https://peter.sh/experiments/chromium-command-line-switches/

(The second page has not, strictly speaking, been updated since August, but the logs for the source file don't show much activity since then in any case.)

You can find examples of how to toggle flags on your OS in the developer documentation:
https://www.chromium.org/developers/how-tos/run-chromium-with-flags

Additionally, Google seems to have added Chromium's native tab discarding feature (formerly accessible through chrome://flags/#enable-tab-discarding) to their extension API, so you could create, add, and configure a plugin like Auto Tab Discard to automatically unload pages depending on activity and memory use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment