Re: Memory fragmentation?

Jean-Marc Desperrier <[email protected]> Fri, 16 Nov 2007 14:28:00 +0100
Newsgroups gmane.comp.mozilla.performance
Message-ID <[email protected]>
Jonas Sicking wrote:
> I think David was talking about a different type of 'leaks' here. We 
> have had instances where objects end up getting stored in places that 
> aren't cleaned up until the browser shuts down.
> [...]
> 
> These types of leaks are hard to measure as they are in fact freed. The 
> best solution we have is looking at the memory-over-time graph to see if 
> it goes up during browser usage.

There are better solutions. The one I use usually is the following :
- Explicitly call a function that report all the memory still used
	- in a text file
	- at application exit, but before global cleanup is done
- Run the application in a blank scenario
- Run the application with the scenario I want to test
- Make a diff of the memory reports

Now it's not always that easy to compare the result, the allocation 
might not always happen in the same order which makes the diff 
difficult, some of the allocation might vary more or less randomly and 
not be really related to my scenario.

One useful strategy out of that :
- First run :
	run the scenario a prime number of time, typically 7
- Second run :
	run the scenario a larger prime number of time, typically 11

Then focus on allocations that are a multiple of 7 in the first case, 
and multiple of 11 in the second.

But this is on applications that are much smaller than Firefox, might 
not scale so well with Firefox.
Enhancing the tools to single out allocations according to how old they 
are might be better for firefox.