r/debian • u/sayed_sahin • 2d ago
8GB RAM Debian was freezing under heavy multitasking — zram fixed it
I was having a memory-related performance issue on Debian 13 GNOME with 8GB RAM.
On Windows 11, I can run Chrome, Firefox with many tabs, VS Code, Postman, Terminal, WhatsApp, etc. together and the system stays smooth even with very high RAM usage.
But on Debian, Firefox + Chromium + VS Code with multiple tabs could make the system extremely slow or even hang when RAM usage got close to full.
With the help of AI, I checked my system and found:
- 7.5 GiB usable RAM
- 5.2 GiB disk swap
- swappiness = 60
- No zram
I enabled zram, and it now looks like this:
/dev/zram0 lz4 3.8G priority 100
/dev/nvme0n1p7 5.2G priority -2
After enabling zram, the problem was solved. Heavy multitasking is now much smoother, even under high memory usage.
So if you're using Linux with only 8GB RAM and running GNOME + multiple browsers + VS Code, checking whether zram is enabled might be worthwhile.
21
u/Final-Ad8341 2d ago edited 1d ago
Use zstd instead of lz4. It's more efficient on compression ratio.
Edit: if you don't know what you need or what you doing read this; https://chrisdown.name/2026/03/24/zswap-vs-zram-when-to-use-what.html
11
u/PavelPivovarov 2d ago
True but its also slower which is important with RAM operations.
3
u/sob727 2d ago
On modern CPUs, cores are so much faster that it shouldnt matter no? CPUs tend to spend most of their time waiting for RAM these days.
7
u/PavelPivovarov 2d ago edited 2d ago
Maybe, but lz4 is ~4 times faster at decompression than zstd, so less waiting for RAM. If latency is important zstd is not an option.
12
u/pesulap_akademik967 2d ago
ZRAM is life saver on limited ram capacity, that's why every operating system nowadays uses ram compression
10
u/ATERLA 1d ago
Everyone’s piling on OP to switch to zswap as if it was the obvious solution. But zram easily solved OP’s problem (mine’s too) so it’s a win.
Anyway, it would be a good thing for the Operating System to detect the size of RAM and propose to optimize it. With zram or zsram, whatever.
10
u/mrcat_romhacking 1d ago
It solves a problem, until it introduces another preventable problem later you'll spend a bunch of time diagnosing. The people telling to switch to zswap are right, it'll prevent a lot of future grief.
9
u/Narishma 2d ago edited 1d ago
For your setup zswap is the better option. zram is for situations where you don't want a swap partition, for example when running on an SD card or eMMC.
3
u/Sturmmoeve 2d ago
Off topic but how do you get such a bottom bar?
2
u/sayed_sahin 2d ago edited 2d ago
With “dash to panel” and “blur my shell” extensions
1
u/raderator 1d ago edited 1d ago
My full list of extensions to get that Win11 look of Zorin/Anduin:
*ArcMenu
*Blur my Shell
*Clipboard Indicator
*Dash to Panel
*Desktop Cube
*Desktop Widgets (Desktop Clock)
*GSConnect
*Gtk4 Desktop Icons NG (DING)
*Legacy (GTK3) Theme Auto Switcher
*Light Style (makes ArcMenu and D to P respect dark Mode)
*Printers
*Tiling Shell
*Weather O'Clock
ArcMenu will need: sudo apt install gir1.2-gmenu-3.0
Run: sudo apt install gnome-themes-extra to make sure you have dark mode for legacy apps.
Be sure to enable the Activities button in ArcMenu.
17
u/sob727 2d ago
Can't imagine running a dev machine in 8GB RAM. Best of luck to you sir.
21
u/j4fade 2d ago
Have you seen the cost of memory these days? Soon, 1GB dev machines could become the norma.
6
u/res13echo 1d ago
Most of us probably running the same 64gb or w/e of ddr4 that we bought in 2022 until our final days with this economy.
1
1
u/PhotoJim99 1d ago
I'm sure glad I maxed out the RAM of all of my machines while RAM was still cheap.
2
u/FoundationOk3176 1d ago
I can, as I do. I just stopped using all of the bloatware except for a browser & 8GB is PLENTY, Unless you're doing web dev stuff. Web dev & it's tooling has been inherently bloated, So you will feel 8GB not being plenty.
Another case it might not be plenty is graphics programming/game development, Although it really depends on what tools you're using & what kind of graphical fidelity you're aiming for.
0
u/cmdr_iannorton 1d ago
you will struggle to do video editing on 8gb
1
u/FoundationOk3176 1d ago
Yes, although it depends on the type of editing & the platform. On Linux pretty much all video editors suck except for DaVinci which I haven't been able to get to work.
I've seen people do video editing without dropping a frame on a MacBook Neo, which comes with 8 GB of RAM iirc.
2
u/Gunhat2023 2d ago
hah imagine attempting to make a recompilation of a game with only 4 gb ram and 2 1.6 ghz cores with integrated graphics
1
2
4
7
u/lproven 1d ago
Good for you, but for future reference:
GNOME is about the heaviest desktop, and KDE is similar. Switch desktop to something light, like Xfce. You can make it look like GNOME or whatever you want.
Similarly, avoid Electron apps like VS Code. Use native apps instead. Zed is fast, Gram is cleaner and simpler. Geany is great.
If you have a fast device to swap onto, Zswap works better than ZRAM.
Don't trust AI. Ever.
4
u/mrcat_romhacking 1d ago
Do note that this person is running their desktop with DPI scaling, which in multi-monitor configs can become a huge headache with XFCE. GNOME suits that need well.
2
u/lproven 1d ago
They are, true, but if it's a single display Xfce can handle this, and X.org supports setting a custom DPI quite easily -- it's 1 line in 1 file -- for a pin-sharp display.
What X11 is poor at is 2 displays with different DPI. Any arbitrary DPI on 1 display, or shared by 2+ the same, is easy.
1
u/mrcat_romhacking 1d ago
Yeah, that's what I was getting at when I specified multi-monitor configs. I find that distinction to be somewhat moot though because this one appears to be a laptop, so the moment a common external display is connected it's overwhelmingly likely to become a mixed DPI setup.
1
u/DeepDayze 1d ago
If you need as much resources for coding perhaps a tiling window manager like i3wm or hyprland would be a better choice.
-4
u/dl452r2f1234 1d ago
Also remember you cannot use Wikipedia to cite sources. Anyone can write whatever they want there.
-3
u/PhotoJim99 1d ago
Trust AI. But verify AI.
AI has been very helpful to me in solving some sticky computing problems. It was instrumental in helping me to modernize and improve my email server infrastructure. But I use multiple AI engines, cross-reference them against each other, and do my own research. I view it as a flawed but helpful resource, not a final answer.
7
u/Snarwin 1d ago
Rather than putting all of this effort into wrangling LLMs, it is much simpler to go directly to reliable, authoritative sources using a traditional search engine.
For example, typing "debian zram" into google will give you this wiki.debian.org page as the first result: https://wiki.debian.org/ZRam
If you read that page, you can then follow a link to this article which explains the difference between zram and zswap, and gives advice about how to choose between them: https://chrisdown.name/2026/03/24/zswap-vs-zram-when-to-use-what.html
When you use a traditional search engine, it's easy to distinguish between high-quality, reliable sources (debian.org, Arch wiki) and low-quality, unreliable ones (reddit posts, blogs, SEO spam). When you use an LLM, all of this information is blended together, and you have to spend a bunch of extra time figuring out which parts are useful and which parts are bogus.
2
u/ButterflyMundane7187 2d ago
zram can help a lot on low-RAM systems, but it’s not always better. It uses CPU for compression, and if you already have fast NVMe swap, zswap can be a better fit because it works as a compressed cache in front of normal swap instead of replacing it.
Windows 11 also tends to handle heavy desktop multitasking under memory pressure more gracefully out of the box, and Windows generally has broader and more mature hardware-driver support, especially for consumer laptops, GPUs, power management, and vendor-specific features.
1
u/MelancholicWandererX 1d ago
Great!
However as many have mentioned for normal usage zswap is better than zram.
Zram still wins in some scenarios (Why fedora still uses it).
Realistically, zswap reducing thrasing on your storage device compared to vanilla swap file, but it's still not as good as Zram (where disk thrasing would be 0 if setup properly). A good systemd-oomd setup is necessary tho for when you still run out of ram.
I've an cheap SSD that I am concerned about, I myself am in decision limbo of sparing my SSD from disk thrashing with zram vs a more optimal and safe swap setup with zswap.
tl;dr if you can switch to zswap it's better. If you don't want to or purposefully chose zram to avoid any disk swap, ensure you removed any swapfile/swappartition and ensure you have systemd-oomd or something setup for when you run out of ram (See how fedora does it and copy that I guess)
1
1
u/jstephenr 1d ago
I have the same machine but with 32GB of RAM. Would I benefit from zram or zswap? I also run multiple browsers with many many tabs and VS Code, Terminal etc.
1
1
u/dinosaursdied 1d ago
I see people recommending zswap over zram but are there situations where having both active could be helpful?
1
u/Big_Hand_19105 1d ago
My laptop has 40GB of RAM, but it still freeze sometime I use just terminal and tens of tabs, do you guys know why?
1
0
u/Readdeo 1d ago
Why are you ricing your desktop when you have 8GB ram? You are just killing your SSD because most of the things ends up in swap anyways.
1
u/sayed_sahin 1d ago
I haven’t heavily customized GNOME at all. I’m only using Dash to Panel and Blur My Shell for a bit of customization. Everything else is basically default GNOME.
Even the system monitor you can see at the bottom-left came with Debian 13 by default.
-1
u/capitantom 1d ago
El problema es Gnome, cambia una interfaz mas ligera, como lxde, o bien XFCE4 es una interfaz profesional. Con Gnome y KDE es una repetición de Windows, desperdicio de recursos en la escuela interfaz gráfica, adornada, que no aporta nada importante al sistema, por el contrario, sometes a estrés los componentes de la tarjeta madre, produciendo consumo de energía y calor, cuello de botella y alentiza la latencia del sistema. ZRAM efectivamente está haciendo una administración más inteligente dela memoria, pero esa capacidad de cómputo debería ser empleada en situaciones que efectivamente justifiquen la demanda de recursos, como software de aplicaciones y no porque la interfaz gráfica consume la mayoría de los recursos y el software de aplicaciones acupa lo que queda disponible. Debe ser al revés, la interfaz gráfica debe consumir pocos recursos y dejar la mayor parte disponible para las tareas.
-5
u/Astrodion123 2d ago
Yeah I disabled file indexing in gnome and enabled zram + swap and boy it is way smoother. Tho unfortunately Linux isn't that good when the ram gets full while windows manages things if ram gets too full
-6
u/sayed_sahin 2d ago
Windows is excellent at RAM management.
-2
u/Astrodion123 2d ago
Well if only it didn't eat that much ram..... But if it gets full it manages to keep the system alive and not freeze it..
4
u/OptimalMain 2d ago
Haven’t experienced full freeze on Linux in a while, but whatever process is hogging memory does get killed.. usually doesn’t matter for me, but it could be bad for some used
-7
u/ButterflyMundane7187 2d ago
You are both right Windows 11 is great at many things and ram management is one of them also consumer products drivers are almost way better on Win 11.
63
u/Netblock 2d ago
zswap will be more cooperative with your nvme swap partition.