The officially official Devuan Forum!

You are not logged in.

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

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

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: 544  

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)

Offline

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

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

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: 544  

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)

Offline

#5 Yesterday 08:59:15

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

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 Yesterday 17:09:04

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

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 browser has no audio-quality optimization for hearing-impaired users.
Perfect for semi-deaf Linux musicians. Fine-tuned Speex resampling delivers a warm, lush reverb sound.

/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  

Patch: unload idle tabs in Firefox (works on Linux, unlike unloadOnLowMemory)
_https://dev1galaxy.org/viewtopic.php?pid=66774#p66774

Last edited by igorzwx (Yesterday 22:39:31)

Offline

#7 Today 15:35:17

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

Re: How to limit RAM usage in Firefox

Thank you.
I don't like Chromium and they subproduct.
I simply want contraints the consumed operation memory for all firefox.

Offline

#8 Today 17:35:24

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

Re: How to limit RAM usage in Firefox

Have you already tried the new pref?

pref("browser.tabs.discardInactive.timeout_ms", 30000);

_https://dev1galaxy.org/viewtopic.php?pid=66774#p66774

Have you already patched and compiled Firefox? Then this pref is for you.
Haven't compiled anything and don't want to? Then this won't help you — the pref only exists in the patched build.

This pref doesn't just limit RAM usage in Firefox — it significantly reduces it.

There is no "max RAM" setting in Firefox, and there can't be — asking for one is like asking a car to use at most 2 liters of fuel per trip. The browser doesn't decide how much memory a page needs; the page does. A heavy site needs heavy memory, or it simply doesn't work.

What Firefox can do is throw away memory it no longer needs. That's what this pref does: tabs you haven't looked at for a while get fully unloaded — the process is killed, the RAM is freed — and they reload when you click them again. It's the only mechanism that actually reduces memory use rather than reacting to it.

If you truly want a hard ceiling, that's the operating system's job (cgroups), not the browser's — and hitting it means the kernel kills Firefox, not that Firefox politely stays under it.

Offline

Board footer