The officially official Devuan Forum!

You are not logged in.

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

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

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 Yesterday 12:31:19

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

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 (Yesterday 18:48:00)

Offline

#3 Yesterday 21:13:36

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

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 (Yesterday 21:15:02)

Offline

#4 Yesterday 22:37:23

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

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 (Yesterday 22:40:49)

Offline

Board footer