Skip to contentSkip to conversation

Interpreting /proc/meminfo. How much free memory do I have?

DISCUSSION antonio.dibacco 4 participants 5 messages Mar 27, 2006

lore
Share & tools
lore
#0 lore raw

Hi,

I'm a little bit puzzled with the fields in /proc/meminfo. Which fields have I to sum up to get the amount of free memory?

Thank you,
Antonio.

#1 lore raw
Quoted 4 lines · antonio.dibacco

Hi,

I'm a little bit puzzled with the fields in /proc/meminfo. Which fields have I to sum up to get the amount of free memory?

=46rom a 2.6 /proc/meminfo

MemTotal:       515532 kB
MemFree:          6012 kB
Buffers:         79964 kB
Cached:          83264 kB
SwapCached:      82840 kB
Active:         294024 kB
Inactive:       130304 kB

=2D - -

Completely free is only MemFree. But those pages are only needed for interrupt handlers (close enough).

Cached pages are also free but since they contain data that maybe will be needed again (unmodified data that already is on disk) they are not returned to MemFree state.

Inactive pages has not been in use for awhile and can be written out if needed (some are probably unmodified and quick to get)

/RogerL

#2 lore raw
Quoted 24 lines · Roger Larsson
Quoted 8 lines · antonio.dibacco

Hi,

I'm a little bit puzzled with the fields in /proc/meminfo. Which fields have I to sum up to get the amount of free memory?

From a 2.6 /proc/meminfo

MemTotal:       515532 kB
MemFree:          6012 kB
Buffers:         79964 kB
Cached:          83264 kB
SwapCached:      82840 kB
Active:         294024 kB
Inactive:       130304 kB

- - -

Completely free is only MemFree. But those pages are only needed for interrupt handlers (close enough).

Quoted 8 lines

Cached pages are also free but since they contain data that maybe will be needed again (unmodified data that already is on disk) they are not returned to MemFree state.

Inactive pages has not been in use for awhile and can be written out if needed (some are probably unmodified and quick to get)

Active + Inactive + MemFree is not equal MemTotal. Where can i find the offset?

Thanks,
Eberhard

#3 lore raw

I don't understand the meaning of "Inactive". They are not used but the kernel cannot give this memory to a requesting process because we tipically don't have a swap device on a linux embedded board. Where we can store the Inactive page? Am I wrong? If I run a process that continuosly allocates memory and print out the total allocated memory when it receives SIGINT or SIGTERM, I think I get the real "free memory"!

Bye,
Antonio.

Eberhard Stoll Scrive:

Quoted 45 lines
Quoted 24 lines · Roger Larsson
Quoted 8 lines · antonio.dibacco

Hi,

I'm a little bit puzzled with the fields in /proc/meminfo. Which fields have I to sum up to get the amount of free memory?

From a 2.6 /proc/meminfo

MemTotal:       515532 kB
MemFree:          6012 kB
Buffers:         79964 kB
Cached:          83264 kB
SwapCached:      82840 kB
Active:         294024 kB
Inactive:       130304 kB

- - -

Completely free is only MemFree. But those pages are only needed for interrupt handlers (close enough).

Quoted 8 lines

Cached pages are also free but since they contain data that maybe will be needed again (unmodified data that already is on disk) they are not returned to MemFree state.

Inactive pages has not been in use for awhile and can be written out if needed (some are probably unmodified and quick to get)

Active + Inactive + MemFree is not equal MemTotal. Where can i find the offset?

Thanks,
Eberhard

_______________________________________________
Linuxppc-embedded mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-embedded

#4 lore raw
Quoted 7 lines · antonio.dibacco

I don't understand the meaning of "Inactive". They are not used but the kernel cannot give this memory to a requesting process because we tipically don't have a swap device on a linux embedded board. Where we can store the Inactive page? Am I wrong?
If I run a process that continuosly allocates memory and print out the total allocated memory when it receives SIGINT or SIGTERM, I think I get the real "free memory"!

The "big picture" is that the kernel assumes that any physical memory that is not used is being wasted. The kernel tries to anticipate what data you will need and loads it into memory before you actually require it. This way there is no time delay when you want to access it. So the numbers are reflecting what the system/kernel is currentl using.

Even if you are on a system with no swap parition like your embedded board, pages in memory that are read-only can still be swapped out since they can always be read back in when needed. Sections like a processes .text fit this category.

If you are trying to look at a specific process, perhaps looking at the /proc/<pid>/status might help you analyze your memory needs.

Jeff Angielski
The PTR Group