improving malloc

Ondřej Bílka neleai@seznam.cz
Sun Jan 6 20:10:00 GMT 2013


On Sat, Jan 05, 2013 at 10:02:42AM +0100, Ondřej Bílka wrote:
> 
> As malloc is concerned I have several ideas how to improve it.

I also want to comment other suggestions from wiki. Here is first

Chris Metcalf: 
* Hooks to allow arenas to be created using huge pages (either default
size or particular sizes)  

This has problem that huge pages increase memory usage. When application
overcommit memory then small pages are advantage. 

Second problem is fork. It is wasteful to copy huge page when only small 
part changes.

My ideas how to address this is either:

1) Use new function(say huge_malloc) so programmer is aware of these
drawbacks.

2) Profiling. One could track how many pages allocations used/ if fork
happened and then decide if huge pages are profitable. 

It has drawback that programmer must do profiling. When programmer
does this he can add suitable mallopt. 

Huge pages are much better with garbage collection runtimes as heap
compactification reduces first problem.



More information about the Libc-alpha mailing list