You are not logged in.

#1 2014-03-12 17:49:33

r0b0t
Member
From: /tmp
Registered: 2009-05-24
Posts: 505

How to free some cached RAM?

Hi,

the problem here is the to much of the system RAM is keept cached

$ free -mt
             total       used       free     shared    buffers     cached
Mem:          3904       2506       1397        171        141       1508
-/+ buffers/cache:        856       3047
Swap:            0          0          0
Total:        3904       2506       1397

I know, the actuall in-use RAM is 856 and not 2506 but still that cached memory it stays like that for to long, and if I add virtual machines to the equation the situation becomes bitter smile

Even when very few process are running, the RAM keeps like that even after all programs are closed and nothing is running.

This is what is actually consumed:

 Private  +   Shared  =  RAM used	Program 

200.0 KiB +  38.5 KiB = 238.5 KiB	xinit
212.0 KiB +  34.5 KiB = 246.5 KiB	dbus-launch
272.0 KiB +  23.0 KiB = 295.0 KiB	dnsmasq
236.0 KiB +  61.0 KiB = 297.0 KiB	gnome-pty-helper (2)
276.0 KiB +  31.5 KiB = 307.5 KiB	fcron
276.0 KiB +  53.5 KiB = 329.5 KiB	rtkit-daemon
260.0 KiB + 182.5 KiB = 442.5 KiB	startx
472.0 KiB +  34.5 KiB = 506.5 KiB	ssh-agent
412.0 KiB + 106.0 KiB = 518.0 KiB	xfconfd
648.0 KiB +  43.0 KiB = 691.0 KiB	systemd-logind
640.0 KiB + 107.5 KiB = 747.5 KiB	gconfd-2
704.0 KiB + 131.5 KiB = 835.5 KiB	gvfsd
768.0 KiB +  72.0 KiB = 840.0 KiB	mount.ntfs
636.0 KiB + 205.0 KiB = 841.0 KiB	gconf-helper
844.0 KiB + 108.5 KiB = 952.5 KiB	ntpd
816.0 KiB + 142.5 KiB = 958.5 KiB	at-spi2-registryd
956.0 KiB +  95.5 KiB =   1.0 MiB	dconf-service
832.0 KiB + 227.0 KiB =   1.0 MiB	login
984.0 KiB + 146.0 KiB =   1.1 MiB	gvfs-gphoto2-volume-monitor
  1.0 MiB + 195.0 KiB =   1.2 MiB	gvfsd-fuse
  1.3 MiB +  73.0 KiB =   1.3 MiB	systemd-udevd
  1.2 MiB + 216.5 KiB =   1.4 MiB	upowerd
  1.0 MiB + 468.0 KiB =   1.5 MiB	(sd-pam)
  1.2 MiB + 261.5 KiB =   1.5 MiB	sudo
  1.4 MiB + 177.0 KiB =   1.6 MiB	wpa_supplicant
  1.6 MiB + 433.5 KiB =   2.0 MiB	csd-printer
  2.0 MiB +  87.5 KiB =   2.1 MiB	gvfsd-metadata
  1.8 MiB + 340.0 KiB =   2.1 MiB	cupsd
  1.4 MiB + 802.0 KiB =   2.2 MiB	bash (3)
  2.1 MiB + 244.5 KiB =   2.4 MiB	ModemManager
  2.2 MiB + 368.0 KiB =   2.6 MiB	gvfs-udisks2-volume-monitor
  1.5 MiB +   1.1 MiB =   2.6 MiB	systemd (2)
  2.4 MiB + 210.0 KiB =   2.6 MiB	syslog-ng
  2.7 MiB + 160.0 KiB =   2.9 MiB	at-spi-bus-launcher
  3.1 MiB + 466.5 KiB =   3.5 MiB	dbus-daemon (3)
  3.4 MiB + 183.5 KiB =   3.6 MiB	gvfsd-trash
  4.0 MiB + 287.0 KiB =   4.3 MiB	udisksd
  3.7 MiB + 671.0 KiB =   4.3 MiB	polkit-gnome-authentication-agent-1
  4.4 MiB + 243.5 KiB =   4.6 MiB	gnome-keyring-daemon
  4.3 MiB + 778.5 KiB =   5.1 MiB	cinnamon-session
  4.7 MiB + 438.5 KiB =   5.1 MiB	pulseaudio
  4.6 MiB + 791.0 KiB =   5.3 MiB	NetworkManager
  4.4 MiB +   1.2 MiB =   5.6 MiB	lxpanel
  4.7 MiB +   1.1 MiB =   5.9 MiB	xfce4-clipman
  6.6 MiB + 734.5 KiB =   7.4 MiB	libvirtd
  4.7 MiB +   3.1 MiB =   7.8 MiB	cinnamon-screensaver
  7.3 MiB +   1.7 MiB =   9.1 MiB	cinnamon-settings-daemon
  8.5 MiB +   1.9 MiB =  10.4 MiB	nm-applet
 10.4 MiB +   1.4 MiB =  11.8 MiB	cinnamon-launch
 11.8 MiB + 268.0 KiB =  12.1 MiB	polkitd
 13.4 MiB + 550.5 KiB =  13.9 MiB	colord
 14.8 MiB +   1.8 MiB =  16.6 MiB	nemo
 14.8 MiB +   2.8 MiB =  17.6 MiB	systemd-journald
 18.8 MiB +   7.0 MiB =  25.8 MiB	Xorg
 36.5 MiB +   6.7 MiB =  43.2 MiB	terminator (2)
175.9 MiB +   6.0 MiB = 181.9 MiB	cinnamon
311.8 MiB +   4.3 MiB = 316.0 MiB	firefox
---------------------------------
                        762.8 MiB
=================================

Ideas?

Offline

#2 2014-03-12 18:16:43

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: How to free some cached RAM?

Run "sync; echo 3 > /proc/sys/vm/drop_caches" to drop whatever caches you can. Doesn't take long to do it, does it? Caches can be dropped pretty instantly, thus their presence shouldn't impair performance.

-edit-

Data in tmpfs is counted as cache and obviously cannot be just dropped - it can be removed or swapped out (but for that you need swap).

Last edited by lucke (2014-03-12 18:25:01)

Offline

#3 2014-03-12 18:22:15

andy123
Member
Registered: 2011-11-04
Posts: 169
Website

Re: How to free some cached RAM?

Why would you want to drop cached RAM? That doesn't make any sense.


i'm sorry for my poor english wirting skills…

Offline

#4 2014-03-12 18:24:56

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,909
Website

Re: How to free some cached RAM?

Why do you think caching is a problem? Have you read www.linuxatemyram.com?


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#5 2014-03-13 02:05:24

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: How to free some cached RAM?

You can just download more RAM: http://www.downloadmoreram.com/

Offline

#6 2014-03-13 03:10:11

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,808

Re: How to free some cached RAM?

karol wrote:

You can just download more RAM: http://www.downloadmoreram.com/

Whiskey, Tango, Foxtrot? -- Over.

tongue


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#7 2014-03-13 21:15:42

r0b0t
Member
From: /tmp
Registered: 2009-05-24
Posts: 505

Re: How to free some cached RAM?

lucke wrote:

Run "sync; echo 3 > /proc/sys/vm/drop_caches" to drop whatever caches you can. Doesn't take long to do it, does it? Caches can be dropped pretty instantly, thus their presence shouldn't impair performance.
-edit-
Data in tmpfs is counted as cache and obviously cannot be just dropped - it can be removed or swapped out (but for that you need swap).


It worked! , Thanks!

andy123 wrote:

Why would you want to drop cached RAM? That doesn't make any sense.

Yes from one part.
The other side is that I want to get opinions on the matter.

WorMzy wrote:

Why do you think caching is a problem? Have you read www.linuxatemyram.com?

Actually is not, I wanted however to check what you guys would say and I got some new heads up and also a command to clean it.
So basically, if I start up my virtual systems and more RAM will needed the system automatically will give the cached RAM to application I suppose.

ewaller wrote:
karol wrote:

You can just download more RAM: http://www.downloadmoreram.com/

Whiskey, Tango, Foxtrot? -- Over.

tongue

I think karol probably meant that because I use virtual machines I need more RAM, but probably I need a new system lol.

Other question, I got some new info from a collegue that ZFS filesystem has extreme performance and it's like having a RAM instead of the HDD,
is this true, and do you guys recommand using it?
Would the caching be different? (more RAM saved?)

Last edited by r0b0t (2014-03-13 21:16:59)

Offline

#8 2014-03-13 22:10:17

cris9288
Member
Registered: 2013-01-07
Posts: 348

Re: How to free some cached RAM?

It's just cached RAM. That RAM is relinquished if required by the OS, so just let the OS handle it.

Offline

#9 2014-03-14 05:03:42

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: How to free some cached RAM?

I think www.linuxatemyram.com that WorMzy posted is all you need to (re-)read.


No HDD filesystem will act as fast as RAM unless the data is cached in RAM.
For more info about ZFS, see e.g. https://wiki.archlinux.org/index.php/ZFS

Offline

#10 2014-03-14 05:50:00

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: How to free some cached RAM?

r0b0t wrote:

Other question, I got some new info from a collegue that ZFS filesystem has extreme performance and it's like having a RAM instead of the HDD,
is this true, and do you guys recommand using it?
Would the caching be different? (more RAM saved?)

From what I have read, ZFS is a RAM guzzler. I wouldn't recommend using it unless you have *special* needs. For fast speeds, give xfs a try.

Offline

#11 2014-03-14 06:06:54

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: How to free some cached RAM?

x33a wrote:

From what I have read, ZFS is a RAM guzzler.

Same here.
When I see 'ZFS <fill in the blank> RAM', the <blank> doesn't form 'is as fast as', but 'needs a lot of'.

http://forums.freenas.org/index.php?thr … nts.16874/

ZFS loves RAM, I have read the rule is 1GB per 1TB of raw storage

https://bbs.archlinux.org/viewtopic.php?id=171559
https://www.freebsd.org/doc/handbook/fi … s-zfs.html

Some of the features provided by ZFS are RAM-intensive, so some tuning may be required to provide maximum efficiency on systems with limited RAM.

Offline

#12 2014-03-14 10:29:39

r0b0t
Member
From: /tmp
Registered: 2009-05-24
Posts: 505

Re: How to free some cached RAM?

x33a wrote:
r0b0t wrote:

Other question, I got some new info from a collegue that ZFS filesystem has extreme performance and it's like having a RAM instead of the HDD,
is this true, and do you guys recommand using it?
Would the caching be different? (more RAM saved?)

From what I have read, ZFS is a RAM guzzler. I wouldn't recommend using it unless you have *special* needs. For fast speeds, give xfs a try.


Yep, already did, it's great
$ mount -l | grep xfs
/dev/sda7 on /home type xfs (rw,noatime,attr2,inode64,logbufs=8,noquota) [/home]

Offline

Board footer

Powered by FluxBB