[Patch] Memory allocation fixes (was: Re: konqy preloading kills performance)

Koos Vriezen koos.vriezen at xs4all.nl
Fri Dec 17 12:34:22 GMT 2004


On Wed, Dec 15, 2004 at 08:51:29AM +0000, Germain Garand wrote:
> Hi!
> 
> Here attached are some fixes to the Arena allocator (which is responsible of 
> managing memory for most of the Rendering engine) which could help /wrt the 
> issues mentioned in this thread.
> 
> It mostly:
> 1) avoids leaking the global Arena freelist in case the last khtml part gets 
> unloaded.

Looks like an obvious bug fix to me, no?

> 2) enforces the FREELIST_MAX limit. It currently is not and would happily use 
> as many gigabytes as you'd throw it, without ever freeing them.

I don't follow you here. There is a 'freelist_count >= FREELIST_MAX'
check. And if this call doesn't work, next one will?

> 3) introduces a change of memory allocation strategy for heavy pages: over a 
> given threshold, increase the pool sizes so that malloc gets a chance to give 
> some ressources back to the OS (mostly via munmapping, though trimming is 
> also more likely to happen with large chunks).

So if cumul becomes > 2Mb, it starts allocating pages with minsize of
80kb (instead of 4kb). Are you sure it would help, ie. why not start with
larger pages in the first place? And what about mmap'ing our self?
Have you done some benchmarking here?

> 
> Here, this would give back about 35% of freed memory to the system after a 
> heavy document gets unloaded.
> What do you think?
> 
> Greetings,
> Germain





More information about the kfm-devel mailing list