-
LINUX > gestion de la mémoire RAM
Pour savoir ce qui est gourmand en mémoire :
top -n3 -o%MEM
—
free -h
cat /proc/sys/vm/drop_caches
sudo sh -c "sync; echo 3 > /proc/sys/vm/drop_caches"
free -h
cat /proc/sys/vm/drop_caches
—
free -h
renvoie :
total utilisé libre partagé tamp/cache disponible Mem: 3,8G 1,6G 277M 84M 1,9G 1,8G Partition d'échange: 2,0G 96K 2,0G
*****:~$ cat /proc/sys/vm/drop_caches 0
*****:~$ sudo sh -c "sync; echo 3 > /proc/sys/vm/drop_caches"
[sudo] Mot de passe de ***** :
*****:~$ free -h
total utilisé libre partagé tamp/cache disponible
Mem: 3,8G 1,6G 1,8G 84M 351M 1,9G
Partition d’échange: 2,0G 96K 2,0G
*****:~$ cat /proc/sys/vm/drop_caches 3
En fait la commande a bien vidé le cache en mémoire :
- AVANT :
tamp/cache → 1,9G
libre → 277M
- APRÈS :
tamp/cache → 351M
libre → 1,8G