The officially official Devuan Forum!

You are not logged in.

#1 2026-11-29 19:07:03

sergey1212
Member
Registered: 2026-03-05
Posts: 5  

How to limit RAM usage in Firefox

6.1.0-54-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.190-1 (2026-10-16) x86_64 GNU/Linux
daedalus
i3 + X11 + systemV

I want limit allowed operation memory for Firefox. But method from DeepSeek with create group and run firefox woth additional parameter don't work in Devuan.
-->>
sudo mkdir -p /sys/fs/cgroup/init
echo 1 | sudo tee /sys/fs/cgroup/init/cgroup.procs
echo "+memory" | sudo tee /sys/fs/cgroup/cgroup.subtree_control
-->>

After confirming that memory appears in cgroup.subtree_control, execute:
-->>
# 1. Create cgroup
cgcreate -g memory:firefox_limit

# 2. Set hard limit (example: 3G)
echo 3G | sudo tee /sys/fs/cgroup/firefox_limit/memory.max
-->>

I give error:
-->>
cgexec -g memory:firefox_limit firefox-esr
cgroup change of group failed
-->>

How i can setup limited access to operation memory?

Last edited by sergey1212 (2026-11-29 22:00:56)

Offline

#2 2026-11-30 12:31:19

igorzwx
Member
Registered: 2024-05-06
Posts: 541  

Re: How to limit RAM usage in Firefox

// file: /etc/firefox-esr/ipc.js  
 
pref("dom.ipc.processCount", 4);                    // default 8  
pref("dom.ipc.processCount.webIsolated", 2);        // default 4 (Fission per-origin)  
pref("dom.ipc.processPrelaunch.fission.number", 1); // default 3 prelaunched procs  
pref("browser.tabs.unloadOnLowMemory", true);       // default false on Linux  
pref("browser.tabs.min_inactive_duration_before_unload", 300000); // default 600000 ms  
pref("browser.tabs.remote.warmup.enabled", false);  // speculative tab warmup  
pref("browser.cache.memory.capacity", 65536);       // KB; -1 = dynamic

about:memory > "Minimize memory usage" triggers an immediate GC/heap-minimize for diagnosis.

Verify with about:processes

A hard limit doesn’t reduce memory usage — it punishes you for exceeding the limit. Handy for masochists:

systemd-run --scope -p MemoryMax=3G firefox-esr

memory.max gives Firefox zero warning; when the cgroup hits the ceiling, the kernel OOM-killer picks a process and kills it outright. The user loses whatever was in that tab — form data, session state, downloads in flight — with no chance to save anything. Firefox's own mechanisms are cooperative: they shrink memory gracefully (unload the least-recently-used tab, flush caches, GC) instead of killing things.

Last edited by igorzwx (2026-11-30 18:48:00)

Online

#3 2026-11-30 21:13:36

sergey1212
Member
Registered: 2026-03-05
Posts: 5  

Re: How to limit RAM usage in Firefox

Thanks for answer.
I make this setup:

browser.cache.memory.capacity 

But it didn’t achieve anything.

browser.tabs.unloadOnLowMemory

might not work on Linux.
According to discussions within the Mozilla community, the low-memory detection mechanism on Linux has been disabled.

I use Devuan with SystemV and the systemd method doesn't work.

I make

pref("browser.tabs.min_inactive_duration_before_unload", 300000);

  and will see how it's work for me.

Last edited by sergey1212 (2026-11-30 21:15:02)

Offline

#4 2026-11-30 22:37:23

igorzwx
Member
Registered: 2024-05-06
Posts: 541  

Re: How to limit RAM usage in Firefox

Try

// file: /etc/firefox-esr/memory.js 
 
pref("dom.ipc.processCount", 2);                    // shared web processes, default 8  
pref("dom.ipc.processCount.webIsolated", 2);        // Fission per-origin, default 4  
pref("dom.ipc.processPrelaunch.fission.number", 1); // prelaunched procs, default 3  
pref("browser.sessionhistory.max_entries", 10);     // default 50  
pref("browser.sessionhistory.max_total_viewers", 0);// bfcache viewers, default -1  
pref("browser.tabs.remote.warmup.enabled", false);  // speculative warmup  
pref("network.prefetch-next", false);  
pref("network.http.speculative-parallel-limit", 0);  
pref("extensions.pocket.enabled", false);

Verification:

firefox-esr about:memory about:processes about:cache

Open several tabs: youtube/rutube, etc.
Check tabs about:memory and about:processes (memory usage)

Last edited by igorzwx (2026-11-30 22:40:49)

Online

#5 Today 08:59:15

sergey1212
Member
Registered: 2026-03-05
Posts: 5  

Re: How to limit RAM usage in Firefox

Thank you.
I would like to limit the Firefox processes of its maximum memory consumption; that is the point of my initial question. I do not want to use ineffective tweaks from the Firefox settings—besides, those don’t actually limit the memory usage of the Firefox process itself; they only affect the pages of open websites.

Offline

#6 Today 17:09:04

igorzwx
Member
Registered: 2024-05-06
Posts: 541  

Re: How to limit RAM usage in Firefox

Min is a fast, minimal browser that protects your privacy.
Min's tab model is explicitly designed so a tab can exist without a loaded web view, and views get destroyed/recreated on demand. The state layer tracks this via hasWebContents and lastActivity on each tab.
Min has no audio-quality optimization for hearing-impaired users.
Perfect for semi-deaf Linux musicians.

/opt/Min/min --audio-buffer-size=8192 %U

--audio-buffer-size is a Chromium switch, and since Min is just Electron, the flag reaches Chromium's audio stack directly. The Chromium ALSA backend has a PulseAudio workaround built in.  The ALSA output path detects a running PulseAudio server and routes through it instead of opening the hardware device directly.

Testing a new Firefox pref to unload idle TABs (similar to Min/Brave browsers).

// Enable "idle tab discard" by setting it to a preferred value > 0
// 1800000 is milliseconds = 30 minutes (30 × 60 × 1000)
//  600000 is milliseconds = 10 minutes (10 × 60 × 1000)
pref("browser.tabs.discardInactive.timeout_ms", 600000);

Have you tried to compile Firefox? I could post a patch later.

firefox-dev about:support about:config about:processes about:memory

4 TABS (about: ) + 3 youtube + rutube

about:processes

        Name                                    | Memory  | CPU   |   ⚙
Firefox Developer Edition (4879)                  403MB     1.8%  
11 active threads out of 84: firefox-dev 1%,...
Extensions (4975)                                 181MB     0.21% 
22 inactive threads 
Fork Server (4970)                                 12MB     idle  
1 inactive thread 
Preallocated (5721)                                20MB     idle  
20 inactive threads 
About pages (5018)                                 88MB     idle  
Preloaded New Tab 
23 inactive threads 
Data Decoder (4994)                                 36MB    idle  
7 inactive threads  
Utility (5114)                                      18MB    idle  
JavaScript Oracle 
Generic Audio Decoder 
6 inactive threads  

Last edited by igorzwx (Today 19:49:25)

Online

Board footer