r/linuxquestions • • 12d ago

Support Varying ram usage

Why does ram vary so much between different hardware/people ?

I often see people with builds at ~500mb idle, some are even lower so I wondered how it's possible and what makes that happen ? For example I tried Arch and was at ~700 in the tty, and Gentoo was at ~600 but even if the tty in my opinion uses quite a lot, the more interesting part is apps. For example the sole reasons I'm not using kitty and hyprland is because of their ram usage, both of them were using ~250-350mb of ram each on their own, and I had to replace them with foot which would use ~30mb and sway which would use ~90-110mb, but it came to my surprise when I was watching videos and looking at people's btop ram usage that kitty was using ~50-100mb. Even more so, recently asked a friend of mine to share his, and they have kitty on 127mb, but also hyprland at 55mb ?!?! How, just how ? Why is hyprland using at least 5x more ram for me than it is for them ? I tried disabling animations and everything unnecessary in hyprland but it genuinely made no difference, so I just switched to sway. Matter of fact I even tried more wm's like mango, river, niri, wayfire, and they would each use at least 300-350mb, which is surprising because I thought hyprland was supposed to be the heavy one. I thought it was kernel configuration at first but he's just using stock fedora. Even as of writing this asked someone else and hyprland is using ~50mb and kitty's at ~80mb, so does anyone mind enlightening me as to what is going on and if I can somehow fix this ?

9 Upvotes

19 comments sorted by

6

u/Excellent-Love-6943 12d ago

When you have more ram, more stuff gets cached.

My 32GB ram desktop idles with over 1-1.5GB used, my 8GB laptop idles at around 800mb. Same setup: Arch with Plasma.

Obviously you have to add variance for background applications, other DEs/WMs, etc.

2

u/Otherwise_Win_5363 12d ago

I know about cache but I don't think that explains the variety, since I'm mainly talking about ram usage on apps, on os's u have to scale based on total ram ofc.

1

u/Rifter0876 12d ago

Depends on the distro too, some cache rather aggressively, for example my Fedora system has no problem eating 80-90GB of my 128 but it's all cache other than 4GB running the DE (KDE)

1

u/mredding 9d ago

This is something you can ask Google AI, and it can walk you through. For the sake of your question, I asked it to help me see what specific programs are using how much physical RAM, and it gave me a command to run:

me@ubuntu:~/$ ps -eo pid,comm,rss --sort=-rss | head -n 11 | awk '{printf "%-8s %-20s %.2f MB\n", $1, $2, $3/1024}'
PID      COMMAND              0.00 MB
10305    firefox              621.71 MB
8858     gnome-shell          327.08 MB
11045    Isolated             0.00 MB
9993     gjs                  206.33 MB
10499    Privileged           0.00 MB
11340    ptyxis               187.30 MB
9852     mutter-x11-fram      130.02 MB
10716    WebExtensions        120.68 MB
9314     Xwayland             114.67 MB
11277    Web                  0.00 MB
me@ubuntu:~/$ 

Alright, what ARE these programs? Of course Firefox is fat, I'm not worried about that right now. I asked the AI what gjs is and why it's so large - it's a Javascript engine GNOME uses.

I asked if I can reduce the memory usage of gjs and it said no BECAUSE of the underlying libraries and implementation details it depends - this stuff has to take up some amount of space; but what I can do is disable it, or the GNOME extensions that rely on it, and then it gave me a compelling walk-through on how to do some of that.

The point isn't to copy/paste what it gives me and cause damage, but to have a conversation about my system with an agent that can respond faster than you're going to get on Reddit. And you get breadcrumbs so you can ask more questions. NOW I'm genuinely curious about what GNOME extensions I'm running but don't use or need...

In the end, you can figure out why your system is the size it is until you basically get down to the philosophical Q&A of what makes one distro different from another? The packages it's made of - what choices and compromises that represents, and how those packages are compiled for size or speed or features... gjs comes down to two libraries called SpiderMonkey and GTK4 and their inherent sizes, and if you can code a smaller Javascript engine, you're welcome to do it. Right? These things are about as small as they can go, and different distros are going to have different philosophies and opinions about how to run a distro and what all should be running.

I mean, there are still Linux distros that aim to fit on floppies and other extremely small form factors (by today's standards), and more than just that - small memory footprints. But what all must you sacrifice to get there? You ain't getting Ubuntu out of that.

2

u/Otherwise_Win_5363 9d ago

I'm good on using an ai mate, i wanna solve the problems myself not with an ai, preferably with human help or by reading books. And the question wasn't how to make my system use less ram, it was mainly why does ram vary so much for the same programs between people.

1

u/mredding 9d ago

Fair enough, I was just offering you a way to find out. AI doesn't make you stupid if you don't want it to, we were saying back in 2019 that AI was going to make a good mentor and personal tutor. It's just a tool.

1

u/Otherwise_Win_5363 9d ago

Was or wasn't?

1

u/ipsirc 12d ago

How, just how ?

Just don't run unnecessary services.

Ask them which services they are running. You have a mouth and a keyboard.

Even as of writing this asked someone else and hyprland is using ~50mb and kitty's at ~80mb, so does anyone mind enlightening me as to what is going on and if I can somehow fix this ?

I'm pretty sure they didn't load any modern gpu driver which costs hundreds of megabytes alone. You can go even lower at the cost of performance.

1

u/Otherwise_Win_5363 12d ago

Few more questions, I suspect some of the ram issues may be caused by having an igpu ? Got any ideas if that could be the cause ? At the same time, I don't think an igpu could explain the os using so much ram, so that might have to do with kernel config, if so, do you perhaps know any video tutorials/books that you could recommend for this ? Since I'd rather spend time learning that, than trying to fix it with ai not knowing what I'm doing.

1

u/ipsirc 12d ago

Just run ps_mem to find out ram usage and disable the unnecessary services/processes.

The quick tutorial: disable what you don't use.

Quick tutorial #2: install a bare minimal system and add only components what are important for you.

1

u/Otherwise_Win_5363 12d ago

Don't got ss installed yet and I was wrong by a few tens of mb, but this is how it is rn.

1

u/ipsirc 12d ago

You see that sway is the biggest bloat there.

You'd replace systemd-udevd with eudev, foot with a lighter terminal, and bash with mksh, agetty with fgetty. elogind is not a musthave service, and you can stop dhcp client after gained an ip.

1

u/Monoyo- 12d ago

igpu memory usually sits in its own pool, so it probably isnt why two machines show such different system ram. a lot of the gap is just the metric: the used number includes cache, and rss counts shared libraries once per process, so the same desktop can look totally different depending on what you compared.

1

u/Otherwise_Win_5363 12d ago

Yeah it already carved out 2gb for itself, tried to lower it in the bios but it doesn't let me, but I was thinking about gpu acceleration tbh.

2

u/EatTomatos 12d ago edited 12d ago

I mean, Debian and Fedora are both known for breaking up libraries into separate packages. This is not how software is usually packaged. Arch linux experimented with it a little at one point, but they went with the sane option of keeping packages contained like they are shipped as.

This means when you install a arch package, you get everything for that package. Now arch doesn't force optional packages, but they are still available. 

So perhaps something about Fedora and how they configure systemd and packages is causing aggressive sleeping of non essential services.

1

u/EatTomatos 12d ago

And just in general, yeah check your services. My Debian system actually uses more ram than my arch system, because of services.

Also, when you measure this what metric are you using. Top can give you the actual ram usage that excludes kernel calculations.

1

u/Rifter0876 12d ago

It also caches more aggressively than any other distro I've used.

1

u/SuAlfons 11d ago

It varies with what services run in the background. What extensions and helper apps you use. And cache will be bigger when you have more RAM.

I don't even know my idle RAM consumption. My system runs well and I use a boatload of extensions on Gnome

1

u/Open-Adhesiveness-86 11d ago

half of this is a measurement artifact. btop shows RSS, which counts every shared page in full and also counts whatever the gpu driver maps into the process, so hyprland on nvidia looks enormous next to the exact same build on intel/amd. compare cat /proc/<pid>/smaps_rollup and read Pss instead, the numbers usually collapse to within noise of your friend's.