Commit 37e14889 authored by intrigeri's avatar intrigeri

Make Tor Browser less memory-hungry on systems with less than 3 GiB of RAM (refs: #15716).

With 2 GiB of RAM, the default settings (4 content child processes) make Tor
Browser eat way too much memory: Tor Browser starts breaking after some browsing
and our check for upgrades may fail. With 3 GiB of RAM and the default settings,
once I open a bunch of tabs, start LibreOffice, Thunderbird, Files and KeePassX,
then the system still works and Tor Browser is still snappy.
parent 3e15d9c9
......@@ -57,6 +57,8 @@ start_browser() {
mkdir --mode=0700 -p "$TMPDIR"
export TMPDIR
configure_tor_browser_memory_usage "${PROFILE}"
# We need to set general.useragent.locale properly to get
# localized search plugins (and perhaps other things too). It is
# not enough to simply set intl.locale.matchOS to true.
......
......@@ -114,3 +114,23 @@ supported_tor_browser_locales() {
basename "${langpack}" | sed 's,^langpack-\([^@]\+\)@.*$,\1,'
done
}
set_firefox_content_process_count() {
local profile="$1"
local count="$2"
set_mozilla_pref "${profile}/prefs.js" \
"dom.ipc.processCount" "$count" \
user_pref
}
configure_tor_browser_memory_usage() {
local profile="${1}"
# Unit: KiB
system_ram=$(awk '/^MemTotal:/ { print $2 }' /proc/meminfo)
if [ "$system_ram" -lt "$((3 * 1024 * 1024))" ]; then
set_firefox_content_process_count "$profile" 2
fi
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment