Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Debian install using less memory than Gentoo
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
megalodon
n00b
n00b


Joined: 19 Jun 2021
Posts: 19
Location: Rio de Janeiro, Brazil

PostPosted: Sat Dec 18, 2021 2:46 am    Post subject: Debian install using less memory than Gentoo Reply with quote

Hi guys,

I very recently installed Gentoo on my new machine and Debian on a VM (KVM/QEMU/Virt-manager). My Gentoo setup has a custom kernel planned to fit my machine and free from any other hardware, packages were compiled for my specific architecture. My debian vm has a generic kernel and generic packages. Both machines have (at that time) a minimal install: No DE, WM, wireless, Bluetooth, sound. Nothing but network connection, sshd and htop.

Gentoo memory usage after boot was around 90 MB (after shaving the kernel, before were around 105 MB), and Debian was 50 MB.

I know 50 MB difference is negligible for the user, and that's not the point here. It`s just for educational purposes, how can a generic Debian install use less memory than a customized, compiled, Gentoo install? Is this result expected? Did I forgot some step when installing Gentoo?

Gentoo:
+ Ryzen 5 5600G
+ MSI B450 Mortar MAX
+ 32GB

Debian:
+ Emulated CPU (Maybe a Xeon, I'll check)
+ 4GB
Back to top
View user's profile Send private message
mike155
Advocate
Advocate


Joined: 17 Sep 2010
Posts: 4438
Location: Frankfurt, Germany

PostPosted: Sat Dec 18, 2021 3:15 am    Post subject: Reply with quote

How do you measure memory consumption?

Do you clear caches before measuring memory consumption?

Please show us the commands you use.
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 8291
Location: Saint Amant, Acadiana

PostPosted: Sat Dec 18, 2021 3:28 am    Post subject: Reply with quote

The key word here is "customized", did you start your kernel configuration with 'make allnoconfig'? My box uses 110 MB with OpenBox loaded with some additional programs (conky, audacious, tint2, wbar, feh).
_________________
My Gentoo installation notes.
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
megalodon
n00b
n00b


Joined: 19 Jun 2021
Posts: 19
Location: Rio de Janeiro, Brazil

PostPosted: Sat Dec 18, 2021 4:11 am    Post subject: Reply with quote

mike155 wrote:
How do you measure memory consumption?

Do you clear caches before measuring memory consumption?
Please show us the commands you use.

I boot, login and then run htop in both cases. As I used the same simple process I thought was a fair comparison. What command do you suggest to clear cache?

Jaglover wrote:
The key word here is "customized", did you start your kernel configuration with 'make allnoconfig'? My box uses 110 MB with OpenBox loaded with some additional programs (conky, audacious, tint2, wbar, feh).

I used make menuconfig as shown in the handbook. I checked what was suggested and unchecked what I know I'll not use like wireless, bluetooth, most hid support and Intel modules. I'll search about allnoconfig.
Back to top
View user's profile Send private message
Arctic5824
n00b
n00b


Joined: 04 Dec 2021
Posts: 23

PostPosted: Sun Dec 19, 2021 1:23 am    Post subject: Reply with quote

megalodon wrote:
I boot, login and then run htop in both cases. As I used the same simple process I thought was a fair comparison. What command do you suggest to clear cache?

I recommend you to check out https://www.linuxatemyram.com/ , it is a great resource for understanding _how_ linux uses the ram on the system

a better way to check would be "free -m" (as root) and read "available"
Back to top
View user's profile Send private message
mike155
Advocate
Advocate


Joined: 17 Sep 2010
Posts: 4438
Location: Frankfurt, Germany

PostPosted: Sun Dec 19, 2021 2:26 am    Post subject: Reply with quote

@megalodon: Linux uses RAM to cache files.

Let's take a look at the output of 'free' on my machine
Code:
$ free
               total        used        free      shared  buff/cache   available
Mem:        65199976     1316476    63472672       82796      410828    63266908
Swap:              0           0           0

There's a 'free' value and an 'available' value.

Let's read a large file to fill a part of the cache:
Code:
$ dd if=~/large_file >/dev/null
$ free
               total        used        free      shared  buff/cache   available
Mem:        65199976     1286328    55110984       82552     8802664    63289256
Swap:              0           0           0

The 'free' value goes down, but 'available' doesn't change.

Let's clear the caches:
Code:
$ sync; echo 3 >/proc/sys/vm/drop_caches
$ free
               total        used        free      shared  buff/cache   available
Mem:        65199976     1301864    63488296       82764      409816    63281080
Swap:              0           0           0

The 'free' value is back to it's original value.

If you want to compare memory consumption, use the 'available' values. Alternatively, you could clear caches and use the 'free' values.
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