Subject: Re: file creation decreases memory !
To: None <email@example.com>
From: Jukka Marin <firstname.lastname@example.org>
Date: 03/02/2004 09:55:30
On Tue, Mar 02, 2004 at 11:40:30AM +0530, email@example.com wrote:
> we are observing that the file copied decreases the top shown free memory ?
> and increases the File memory shown by top i.e
> Memory: 50M Act, 72M Inact, 220K Wired, 1944K Exec, 110M File, 96M Free
This means unused memory pages have been used for file buffer cache.
> This goes on even if we issue sync command (wasnt it supposed to write back
> these dirty pages back to disk ?)
The file has been written to disk, but the buffer cache remains to speed up
reading the same file again.
> what happens further is that if say a program asks for memory it goes down
> saying out of swap ??
Memory used by the buffer cache is available to processes. If you run out
of memory, pages from the buffer cache are allocated for processes.
It's just better to use the unallocated memory for buffering data than
not using it at all.