Module is showing high amount of Inactive memory

book

Article ID: 167818

calendar_today

Updated On:

Products

XOS

Issue/Introduction

The article deals with Inactive memory and discusses whether high allocation represents an issue.The content of /proc/meminfo shows high amount of Inactive memory. Here is an example:

# cat /proc/meminfo
MemTotal:      16409728 kB
MemFree:       1081228 kB
Buffers:       461068 kB
Cached:        794968 kB
SwapCached:    0 kB
Active:        1045420 kB
Inactive:      13114388 kB
...

 

Cause

Definition of Inactive memory:

The total amount of buffer or page cache memory that are free and available. This is memory that has not been recently utilized by any application for some time and can be reclaimed for other purposes by the paging algorithm.

The Inactive pages are the first candidate for eviction should the system come under memory pressure. High values are not harmful and it is a general behavior of Linux to keep as much cached as opposed to free as possible (it's for better performance in the case of frequently-used items).
 

Resolution

Typically, a large amount of Inactive memory isn't an issue. If required, there are two ways to clear the memory:

1. Reboot the module

or

2. Run the following command sequence that clears the page/dentries/inodes caches:

# sync
# echo 3 > /proc/sys/vm/drop_caches


This is a non-destructive operation and will only free objects that are completely unused. If you still have high levels of usage after running this command, there are still objects actually being used by a process and as such can not be cleared without killing the process or restarting the system.

Workaround

N/A