Re: Memory fragmentation?

Jean-Marc Desperrier <[email protected]> Tue, 20 Nov 2007 19:43:23 +0100
Newsgroups gmane.comp.mozilla.performance
Message-ID <[email protected]>
Justin Dolske wrote:
> Jean-Marc Desperrier wrote:
>> Still it would really useful to see if there's a way to directly tell 
>> the OS the page is no longer used, and can be discarded (not even 
>> stored in swap).
> 
> I'm not sure how useful that is in the common case... It shouldn't 
> directly affect performance, and disk space is dirt cheap. I'd actually 
> be a little wary of a negative perf impact, because the VM system is no 
> longer dealing with a single contiguous, homogeneous block of memory.

You know if this is not a problem, if "disk space is dirt cheap" means 
it's perfectly efficient to use huge amount of swap, then there *no* 
*problem* of memory usage on firefox, people just need to allocate more 
swap, and all developpers better ought to code new feature than lose 
their time on this.

And VM system are *never* dealing with a single contiguous, homogeneous 
block of memory. They are constantly trying to guess which memory page 
you application has stopped using to give it to another application. 
After a little while of that, memory is fragmented between apps like 
crazy. Memory of any application is fragmented like crazy between the 
part that's in RAM and the part that's on disk, so there's no cost in 
having a third part that's simply not used.

The truth is Windows by default will not allocate more than three time 
the physical memory in swap, because around that threshold performance 
becomes abyssal. Have you actually never seen Windows become completely 
irresponsive with the hard drive head noise telling you it's doing 
nothing but moving memory pages in and out of the drive ?
On computers that lacks memory, if frequently happens that after not 
using firefox for a while, when you come back to it, it swaps like crazy 
before becoming functionnal again, this taking much more time than the 
initial startup time.
When you see user seriously complaining about Firefox memory usage, 
that's that kind of problems they are complaing about.

The trouble with swap is the time and performance impact it takes to 
write/read the memory to disk, and that is, opposite to what you seem 
convinced of, in many cases very significant, and in others simply huge.