Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

if I understand correctly, in the following output produced by free, 3535m is the actual free memory available to applications, only 413m is used, is this correct? need some clarification on the difference between Mem and -/+ buffers/cache row.

free -m
             total       used       free     shared    buffers     cached
Mem:          3949       3854         95          0          9       3431
-/+ buffers/cache:        413       3535
Swap:         2047       1322        725
share|improve this question

migrated from stackoverflow.com May 31 '11 at 16:08

This question came from our site for professional and enthusiast programmers.

2 Answers 2

Yes you're right. Buffers and cache are used by the OS but are available to applications immediately. The OS is willing to invalidate and throw away some of the cache in order to satisfy the next request for memory.

share|improve this answer

The Mem: total figure is the total amount of RAM that can be used by applications. This is the total RAM installed on the system, minus:

  • memory reserved by hardware devices (often video memory if the graphics card doesn't have its own RAM);
  • memory used by the kernel itself.

That total includes:

  • free: memory that is currently used for any purpose;
  • shared: a concept that no longer exists. It's left in the output for backward compatibility (there are scripts that parse the output from free).
  • buffers: memory that is backed by files, and that can be written out to disk if needed;
  • cache: memory that is backed by files, and that can be reclaimed at any time (the difference with buffers is that buffers must be saved to disk before they're reused, whereas cache consists of things that can be reloaded from disk);
  • used -buffers/cache: memory used by applications (and not paged out to swap).

In a pinch, the system could run without buffers and cache, reserving RAM for applications and systematically performing disk reads and writes without any caching. The -/+ buffers/cache figures indicate the amount of RAM used directly by applications (used column) and the amount of RAM not used by applications (free column).

Although this can vary a lot, a healthy system typically has around half its RAM devoted to applications and half devoted to buffers and cache. Unless you're running a dedicated file server, your system has more RAM than it needs for what you're currently doing. If the free - buffers/cache figure was low, that would indicate a system that doesn't have enough RAM (contrary to a widespread belief, having a lot of memory devoted to buffers and cache is important for system performance, and trying to reserve more memory for applications would make 99.99% of systems slower).

The swap line is straightforward, it shows the amount of swap that's in use (either by applications or for tmpfs storage), and the amount that isn't.

share|improve this answer

Your Answer

 
discard

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