free (1) is an incorrect designation, it should be more correctly called unused , because this is what it shows. Or perhaps it should be called physicalfree (or rather, the "free" column in the output file should be called "unused").
You will notice that “buffers” and “cached” tend to rise as “free” decreases. The memory does not disappear, it is simply assigned to another "bucket".
The difference between free memory and unused memory is that although both are “free”, unused memory is really like that (without using physical memory), while just “free” memory is often moved to the buffer cache. This, for example, is the case for all executable images and libraries, all that is read-only or read-execute. If the same file is downloaded again, the “free” page is displayed again in the process and data should not be downloaded.
Note that "unused" is actually bad, although it is not immediately obvious (it sounds good, right?). Free (but physically used) memory serves the purpose, while free (unused) memory means that you could save money on RAM. Therefore, using unused memory (for example, by cleaning pages) is exactly what you do not want.
Amazingly, under Windows there are many memory optimization tools that cost real money and that do just that ...
About fixing memory, how it works is easy: the OS simply removes links to all pages of the working set. If the page is shared with another process, nothing exciting happens. If it refers to non-anonymous mapping and cannot be written (or written and not written), it goes to the buffer cache. Otherwise, it will be zap poof.
This removes any memory allocated using malloc , as well as the memory used by executable files and file associations, and (since all memory is page-based) everything else.
Damon source share