1

All host's memory is cached and there's no way it can be freed. /dev/ram1 is used for storing testing files, but after each build we run freeramdisk.

$ freeramdisk /dev/ram1
$ echo 3 > /proc/sys/vm/drop_caches
$ free -m
             total       used       free     shared    buffers     cached
Mem:         12018      11897        120          0          0      11659
-/+ buffers/cache:        238      11779
Swap:         4091       4091          0

# </proc/slabinfo awk '{print $1, $3*$4}' |sort -k2n
# 0
bip-128 0
bip-64 0
bsg_cmd 0
btrfs_delayed_node 0
btrfs_extent_buffer 0
btrfs_inode 0
btrfs_path 0
btrfs_trans_handle 0
dma-kmalloc-1024 0
dma-kmalloc-128 0
dma-kmalloc-16 0
dma-kmalloc-192 0
dma-kmalloc-2048 0
dma-kmalloc-256 0
dma-kmalloc-32 0
dma-kmalloc-4096 0
dma-kmalloc-64 0
dma-kmalloc-8 0
dma-kmalloc-8192 0
dma-kmalloc-96 0
dm_rq_clone_bio_info 0
dm_rq_target_io 0
dm_uevent 0
ecryptfs_inode_cache 0
ecryptfs_key_record_cache 0
ext3_inode_cache 0
ext3_xattr 0
fat_cache 0
fat_inode_cache 0
hfs_inode_cache 0
hfsplus_icache 0
iint_cache 0
jfs_ip 0
kcopyd_job 0
minix_inode_cache 0
nfsd4_delegations 0
nfsd4_openowners 0
nfs_direct_cache 0
ntfs_big_inode_cache 0
ntfs_inode_cache 0
qnx4_inode_cache 0
reiser_inode_cache 0
slabinfo 0
UDP-Lite 0
UDPLITEv6 0
ufs_inode_cache 0
xfrm_dst_cache 0
xfs_btree_cur 0
xfs_da_state 0
xfs_dquot 0
xfs_efd_item 0
xfs_ili 0
xfs_inode 0
xfs_trans 0
zcache_objnode 0
numa_policy 4080
jfs_mp 4096
taskstats 7872
posix_timers_cache 7888
fscache_cookie_jar 8160
journal_handle 8160
ip_fib_trie 8176
dma-kmalloc-512 8192
tw_sock_TCPv6 8192
Acpi-State 12240
dquot 12288
kmem_cache_node 12288
fuse_request 15808
hugetlbfs_inode_cache 16128
fsnotify_event 16320
sigqueue 20000
blkdev_ioc 24336
bip-256 29568
rpc_inode_cache 30720
bdev_cache 31616
bip-16 32256
mqueue_inode_cache 32256
UDPv6 32640
kmem_cache 40960
UDP 48384
ext4_allocation_context 57120
net_namespace 62208
pid_namespace 65040
dio 76800
nfs_read_data 80640
au_finfo 92736
shared_policy_node 93840
blkdev_queue 96000
tw_sock_TCP 108864
nf_conntrack_ffffffff81cbb580 113568
extent_status 126976
journal_head 141120
blkdev_requests 150024
au_icntnr 161920
ext4_free_data 176128
fuse_inode 178112
buffer_head 182520
anon_vma 184320
au_dinfo 184320
files_cache 194304
TCPv6 195840
ext4_io_page 196608
sock_inode_cache 199680
kmalloc-16 200704
kmalloc-8 237568
proc_inode_cache 243360
signal_cache 244800
kmalloc-32 249856
ext4_io_end 252672
kmalloc-96 278208
TCP 279936
kmalloc-128 294912
Acpi-Namespace 297840
ext2_inode_cache 315840
Acpi-ParseExt 318528
nfs_inode_cache 327680
idr_layer_cache 350880
mm_struct 391680
task_xstate 426816
sighand_cache 475200
kmalloc-512 507904
shmem_inode_cache 699840
kmalloc-192 705600
kmalloc-256 708608
kmalloc-2048 729088
vm_area_struct 736736
kmalloc-8192 753664
kmalloc-64 946176
kmalloc-4096 983040
kmalloc-1024 1015808
task_struct 1249920
ext4_inode_cache 1922496
sysfs_dir_cache 2407104
dentry 3148992
inode_cache 4413920
radix_tree_node 25653152

Any idea on how to figure out what the memory is used for?

  • Please post the output of </proc/slabinfo awk '{print $1, $3*$4}' |sort -k2n – Gilles Apr 6 '15 at 23:16
  • I'll post it as soon as it is reproduced again. I don't have any machine in that state now. Thanks – SalvadorG Apr 7 '15 at 8:57
  • Here you have: gist.github.com/sgirones/7ec0565f89212e931bd8 – SalvadorG Apr 7 '15 at 10:18
  • Check df. You probably have a tmpfs mounted somewhere that has filled up. – psusi Apr 7 '15 at 13:09
0

I've tried the same on my system and even if some memory was released, it wasn't 0.

I guess, the remaining memory used is from working files that can't be freed. In my system, I've released from 2G to 1G and all the used cached memory was from running programs.

To check who is using this memory, install https://code.google.com/p/linux-ftools/ (if you are gonna install it in a modern ubuntu, you will need to manually install automake-1.11)

Once installed, the program will show you if a file is cached or not:

root@RandLand:/# linux-fincore --pages=false --summarize --only-cached    /etc/passwd    

filename      size        total_pages    min_cached page       cached_pages          cached_size        cached_perc

--------      ----        -----------    ---------------       ------------        ----- ------        -----------
/etc/passwd   2225              1                  0                  1                 4096             100.00
---
total cached size: 4096

To have a report of the usage by all system, you can run:

find / -type f | xargs linux-fincore --pages=false --summarize --only-cached | tee /tmp/report

/tmp/report will show you what files are filling your cache and you should have a better idea of why they are not being released.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.