[PATCH][RFC] use of mallopt function optimizes HAL work with memory

Sergey Lapin slapinid at gmail.com
Thu Dec 14 19:24:32 PST 2006


David Zeuthen wrote:
> Sergey Lapin wrote:
>> Hi,
>> A patch attached is about
>> optimization of malloc usage for small chunks.
>> Reduces memory fragmentation. Uses mallopt for that.
>> Mostly targeted for small-memory embedded devices.
> 
> I've committed this. Two questions
> 
>  1. what are the wins by doing this?
Less memory stays in malloc() pool. So, visually, less heap consumption 
with many mallocs and frees at random, helped a bit with some gilib 
functions.

Also, adds better chance for small chunk to be mmapped - and thus, give 
it 100% chance to be freed immediately. So, for HAL design, it is benefit.

>  2. what are the costs (if any) by doing this?
more calls to sbrk() syscall.
Actually no difference in speed on nokia770 and qemuarm, at least.
So this is micro-optimization helpful on small devices.


S.


More information about the hal mailing list