Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How does RAM usage work?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
L1NTHALO
n00b
n00b


Joined: 27 Aug 2024
Posts: 14

PostPosted: Sun Oct 20, 2024 9:22 pm    Post subject: How does RAM usage work? Reply with quote

I always want to keep my systems as minimal as possible, that's a huge reason why I switched to gentoo.
On of the most fun parts so far has been checking my idle RAM usage after installing an OS (arch, windows, gentoo etc), the lower the better.

However I have realized some inconsistencies. First of all Gentoo is supposed to be minimal but I often get the same or just slightly higher RAM usage on arch. Sometimes gentoo uses more RAM.

Also on my different gentoo installs memory usage varies. For example kernels that I deemed more minimal than others use the same or more RAM than bigger kernels. And I noticed that systems with more GB of ram use more of it idle.

I used Hyprland, minimal use flags and openrc on all these systems (other than systemd on arch).

Now I know that caching and memory allocation exists but how does it work? For example I noticed that ram usage spikes when starting the system and then gets lower with time (if doing nothing).
Is more RAM getting allocated if you have more system RAM available?
Also do optimizations such as -O3 -lto and other aggressive CFLAGS increase ram usage?

And yes I'm aware that less ram usage =/= better but it's fun to look at fastfetch and see only 200MB ram usage in idle (tty).
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9802
Location: almost Mile High in the USA

PostPosted: Sun Oct 20, 2024 9:54 pm    Post subject: Reply with quote

compare software versions including kernel, which has a great affect on memory usage especially if security options are enabled.
compare init scripts loading in files into cache that are subsequently unneeded later during boot
compare compile optimizations and configuration flags, usually -O3 uses more text RAM and -Os less. It will not affect runtime/stack/heap usage where glibc/kernel/software versions could.
compare how much ram you have (more memory you have, more page table memory needed)
compare drivers/hardware used (using a Trident card will use less memory than an nVidia).

I don't even care anymore on PCs until I actually run out of RAM, and inter-distribution comparisons are virtually worthless. Most of the time the memory is used to improve my experience (things like udisks/elogind/polkit and automount...saves me a manual step of manually mounting) and that's worth the RAM especially if it's not being used -- again unused ram is wasted ram.
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 4985
Location: Bavaria

PostPosted: Sun Oct 20, 2024 11:27 pm    Post subject: Reply with quote

Maybe you are interested in "Tutorial: Linux Memory Management and Containers - Gerlof Langeveld, AT Computing"
https://www.youtube.com/watch?v=ql1axx--8sI
(dont worry, the first part is not about containers; you will also see "atop -B" ;-) )
_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum