Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'd like clarification on whether or not Linux slab memory will be freed (or mostly freed) if userspace programs need it.

I've noticed that one of my Linux systems had a large amount of memory allocated to "slab":

(from slabtop)

834768 834766  99%    0.94K  24552       34    785664K ext4_inode_cache
694092 354151  51%    0.19K  33052       21    132208K dentry

I realize I can clear it out manually if I want to with (sync; echo 3 > /proc/sys/vm/drop_caches) but do I need to or will Linux free it on it's own when needed?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

In short, yes, the kernel will free slabs in order to make room for userspace applications.

The "slab memory" you refer to is memory allocated by the kernel using a technique to reduce RAM fragmentation. It is not a certain type of memory or space reserved for some extra special data. It has been available since kernel version 2.2. The trick is to allocate fixed-sized chunks of memory for use by objects that fit into those chunks, and to manage allocation and deallocation of the chunks as a whole when needed.

Linux keeps as much data resident in RAM as possible in order to speed access. The inode and dentry caches are there to speed up access to your filesystem. If you've got extremely aggressive processes that linux is killing because they're trying to claim too much memory, tuning the cache cleanup parameters may help, but it's unlikely. For that sort of information, see the vfs_cache_pressure documentation.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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