where did all my memory go?
Eric Anderson
anderson at centtech.com
Wed Feb 16 21:48:08 GMT 2005
Brooks Davis wrote:
> On Wed, Feb 16, 2005 at 01:13:13PM -0800, Sean McNeil wrote:
>
>>On Wed, 2005-02-16 at 14:57 -0600, Eric Anderson wrote:
>>
>>>Brooks Davis wrote:
>>>
>>>>On Wed, Feb 16, 2005 at 12:12:10PM -0800, Sean McNeil wrote:
>>>>
>>>>
>>>>>With a system built yesterday on my amd64, I had plenty of memory
>>>>>showing as free when the system completely started up. Even after
>>>>>intense usage I showed lots of free memory in top. Over night at some
>>>>>point all my memory is no longer free but inactive. Is there anything
>>>>>wrong here or is this expected behavior? ps doesn't show any serious
>>>>>usage by any particular process. Also, if disk caches or something were
>>>>>taking up the memory, I would expect it to have shown a lot earlier.
>>>>
>>>>
>>>>On a system that has been up for any significant time, free memory
>>>>should be very small since free memory is wasted. My guess is that it
>>>>is disk cache and that one of the nightly jobs accessed enough stuff to
>>>>fill it.
>>>
>>>Speaking of this - is there a way to flush the disk cache?
[..snip..]
> Sync writes dirty pages, it does not return pages to the free list.
> There is no reason to agressivly return pages to the free list under
> normal load, the system knows which pages have not been modified and
> thus can be added to the free list at virtual no cost so why free pages
> that might be used again. There's little cost in defering that and very
> large potential savings if the data is accessed again later. One way
> this can happen is if you mmap a file and read it, those pages will be
> mapped and will remain mapped until something pushes them out. If they
> are unmodifed, another process that has access to the same data can use
> the cached copy rather then doing a read from disk.
Thanks Brooks for the simple explanation! Makes total sense to me, and is pretty much what I had understood - I was mostly curious :)
On that same topic - let's say someone has a 1TB file, and is using that with geom gate - would portions of that file still be cached as said above, or would they somehow be bypassing the potential caching abilities of the system? What about a geom gate connected directly to a device? Is those cases, would there be any benefit to having a large amount of memory available for caching?
Eric
--
------------------------------------------------------------------------
Eric Anderson Sr. Systems Administrator Centaur Technology
I have seen the future and it is just like the present, only longer.
------------------------------------------------------------------------
More information about the freebsd-current
mailing list