Is Inactive memory related to the Commited but unused?

7,842

Solution 1

Inactive memory is memory that a process used at some point and is still allocated, but which hasn't been used recently. It is the memory that is most likely to be paged out to make room for newly required blocks.

Committed memory is the total of all space which has nominally been allocated to processes. It's the aggregate of all memory space processes believe they have available, including active (in RAM and recently used) inactive (in RAM and used at some point, but subject to paging because its use was not recent) paged out (once in RAM and used, since paged out to swap) and never used (space returned by malloc() but not yet touched)

Solution 2

See man proc; to quote directly:

A process which allocates 1GB of memory (using malloc(3) or similar), but touches only 300MB of that memory will show up as using only 300MB of memory even if it has the address space allocated for the entire 1GB. This 1GB is memory which has been "committed" to by the VM and can be used at any time by the allocating application.

Committed_AS is referring to the total amount of memory requested on the system for dynamic memory allocation; this would mean that inactive memory (which is not in the heap) is not counted. This is where the power of Virtual Memory comes in; a process "thinks" it has all the memory that it requested, but in reality it only has what it needs.

This also ties directly into the overcommit_memory sysctl configuration setting that can be used to prevent "over commitment" of memory so that the server doesn't OOM itself if it ever needs all the "committed" memory at once.

Share:
7,842

Related videos on Youtube

liouk
Author by

liouk

Updated on September 18, 2022

Comments

  • liouk
    liouk over 1 year

    From the Linux procfs documentation:

          Active: Memory that has been used more recently and usually not reclaimed unless
                  absolutely necessary.
        Inactive: Memory which has been less recently used. It is more eligible to be
                  reclaimed for other purposes
    Committed_AS: The amount of memory presently allocated on the system. The committed 
                  memory is a sum of all of the memory which has been allocated by 
                  processes, even if it has not been "used" by them as of yet. (...)
    

    My question relates to the Commited_AS memory, and the part of it that is actually used/unused. My understanding is that Active memory is the part of committed memory that is actually used. However, I do not know what happens with Inactive memory; does it also include the committed but unused memory, apart from memory that has not been recently used?

  • liouk
    liouk almost 10 years
    But isn't inactive memory allocated dynamically at one point or the other? Shouldn't it be actually measured in the Committed as well? I'm trying to break down the committed memory, I'm trying to understand why it's showing less than what's actually used in my system...