Accumulating lots of not easily reclaimable shared and buff cache after waking up from sleep

Hello everyone

Info:

  • System: Manjaro KDE
  • KDE version: 5.21.4
  • CPU: i5-4460
  • RAM: 16 GB
  • Swap: 16 GB
  • Kernel version: 5.11.14-1-MANJARO

Example

Before sleeping

$ free -h
               total        used        free      shared  buff/cache   available
Mem:            15Gi       4,7Gi       9,6Gi       326Mi       1,3Gi        10Gi
Swap:           15Gi          0B        15Gi

After sleep

$ free -h
               total        used        free      shared  buff/cache   available
Mem:            15Gi       5,2Gi       5,9Gi       3,4Gi       4,4Gi       6,7Gi
Swap:           15Gi          0B        15Gi

The most suspicious for me is the shared memory usage as it stays at max ~500MB during normal usage.

Trying to clear chaches

$ sudo bash -c 'sync; echo 3 > /proc/sys/vm/drop_caches'
[sudo] password for : 
$ free -h
               total        used        free      shared  buff/cache   available
Mem:            15Gi       5,2Gi       6,3Gi       3,4Gi       4,1Gi       6,6Gi
Swap:           15Gi          0B        15Gi

Trying to use program that just allocates memory from (linuxatemyram) Experiments and fun with the Linux disk cache

$ sudo swapoff -a 
$ free -h
               total        used        free      shared  buff/cache   available
Mem:            15Gi       5,7Gi       5,2Gi       3,3Gi       4,7Gi       6,3Gi
Swap:             0B          0B          0B
$ ./munch 
Allocated 1 MB
Allocated 2 MB
Allocated 3 MB
...
Allocated 6556 MB
Killed
$ free -h
               total        used        free      shared  buff/cache   available
Mem:            15Gi       5,6Gi       6,4Gi       3,3Gi       3,5Gi       6,4Gi
Swap:             0B          0B          0B

The buff/cache dropped by about 1GB but shared memory didn’t change.


I’m pretty sure that isn’t normal as this affects my ability to run memory hungry apps after some time. (The system freezes if I do so)

I appreciate any help :slight_smile:

3 posts were merged into an existing topic: High cache (RAM) usage and no way of reclaiming it