Why btop lies to me about ram usage?
from 721_bipsty@lemmy.ml to linux@lemmy.ml on 08 Jun 13:02
https://lemmy.ml/post/31361744

Hello, cant attach image cause of file size, i have fresh void linux base install in tty and btop tells me i use 500-600MiB of ram but my top 3 services uses 7-25M and rest are 5>, free -m also tells me 600M but why this much with not much services?

#linux

threaded - newest

zweieuro@lemmy.world on 08 Jun 13:07 next collapse

Are you certain its actual ram usage and not reserved ? Usually when a program requests huge amounts of ram it is not given it until it actually writes to it. Try running free and check what it says.

721_bipsty@lemmy.ml on 08 Jun 13:11 collapse

Freshly rebooted into tty and used free and used: 618876, the thing that takes the most ram is NetworkManager with 17M of ram

zweieuro@lemmy.world on 08 Jun 13:36 collapse

Ah, I accidentally read over that you used free -m.

By top 3 services do you also include any programs ? For me htop itself already consumes 10 MB, what are processes are running ?

721_bipsty@lemmy.ml on 08 Jun 14:29 collapse
lordnikon@lemmy.world on 08 Jun 14:08 next collapse

www.linuxatemyram.com

721_bipsty@lemmy.ml on 08 Jun 14:30 collapse

So should i do used - cache = actual ram? Why then ive seen people have like 100M of ram, could u check my repplyes on this post?

lordnikon@lemmy.world on 08 Jun 14:50 collapse

@nous@programming.dev basically hit the nail on the head looking at available and subtracting from total ram will give you the closest answer to how much ram is being used.

nous@programming.dev on 08 Jun 14:10 next collapse

Can you share the output of free? There are multiple values to read from that.

721_bipsty@lemmy.ml on 08 Jun 14:28 collapse

<img alt="" src="https://lemmy.ml/pictrs/image/9fcf97b6-9d23-41fe-9522-8914fde84ea7.jpeg">

nous@programming.dev on 08 Jun 14:41 collapse

252 of that 592 used memory is buffers/cache, not application memory. That is used by the kernel for kernel buffers and the filesystem cache - IE files read by something at some point. The kernel keeps them in memory in case they are needed again to speed up file reads. You can effectively ignore these vales as they will always grow to fill your ram and will be evicted when programs require memory and there is not enough free.

These tools are not lieing to you, just telling you something other then what you are reading into them. Tracking and reporting on what is using memory is a complex topic and here used is just what is physically allocate. It doesn’t mean much over all as it always tends to be full of your system has been running for a decent amount of time. Available is typically the more useful one to look at as it is an estimate about how much the kernel can reclaim now if an application request it without needing to swap things out.

Llituro@hexbear.net on 08 Jun 19:26 next collapse

looking at the code for btop it appears to just grab this information about memory usage out of /proc/meminfo directly, which you can cat yourself to look at. so if it’s wrong, it seems likely that it’s wrong because meminfo is mistaken in some way.

RhondaSandTits@lemmy.sdf.org on 08 Jun 21:54 next collapse

That number is about right assuming you have disk encryption enabled as the CPU will keep a decent chunk of ram occupied to handle decryption.

pineapple@lemmy.ml on 09 Jun 08:55 collapse

I have a very similar problem activity monitor says 13.6gb of ram used while btop says around 6.9gb.

(activity monitor top)

<img alt="" src="https://lemmy.ml/pictrs/image/80e01acc-b1d9-4576-a805-da02eefe667d.png">

(btop bottom) <img alt="" src="https://lemmy.ml/pictrs/image/4129b6d4-a881-4f90-a768-777e591e6097.png">

MyNameIsRichard@lemmy.ml on 09 Jun 09:04 collapse

Probably activity monitor is counting buffers and caches which btop isn’t.