One of the reasons why
drop_caches won't release memory is because some caches are still in use, for instance by
tmpfs (in-memory) file systems. In order to find out how much memory is allocated for this kind of stuff, you can use
df -t tmpfs --total -h
This command will print out usage for all tmpfs currently in use.
-t tmpfs limits list to
tmpfs systems only,
--total produces grand total for all file systems listed and
-h formats all sizes in human-readable format.
The problem is, some applications customary create temporary files, open them and then delete, without closing. As a result, tmpfs can't release memory since files are still in use. In order to find applications like this, you can use this command:
lsof -nP +L1 /dev/shm | grep DEL
This would list all opened deleted files in
/dev/shm (commonly used system
tmpfs), as well as applications that opened these.
-nP are optimizations for faster execution,
+L1 limits links counting and
/dev/shm specifies directory to scan for opened files. Then,
| grep DEL selects only deleted files from the list.
Chromium is one of most popular software that abuses
/dev/shm for its purposes, so, you might get several GB of deleted files created by chromium- or electron-based applications. And this cache won't be removed with
drop_caches and it won't get freed up in low-memory situations.