[RFC PATCH 1/3] add tlsf memory allocator

Sascha Hauer s.hauer at pengutronix.de
Tue Sep 20 03:35:26 EDT 2011


On Mon, Sep 19, 2011 at 10:24:54PM +0400, Antony Pavlov wrote:
> On 19 September 2011 12:56, Sascha Hauer <s.hauer at pengutronix.de> wrote:
> > Hi Antony,
> >
> > On Thu, Sep 15, 2011 at 02:03:50AM +0400, Antony Pavlov wrote:
> >> got from svn https://www.gii.upv.es/svn/tlsf/trunk@70
> >>
> >> Signed-off-by: Antony Pavlov <antonynpavlov at gmail.com>
> >> ---
> >>  common/tlsf.c  | 1024 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> >>  include/tlsf.h |   39 +++
> >>  2 files changed, 1063 insertions(+), 0 deletions(-)
> >>  create mode 100644 common/tlsf.c
> >>  create mode 100644 include/tlsf.h
> >
> > What's the advantages of this memory allocator? One thing I see is that
> > this one has support for memory pools which is nice to have. Are there
> > more advantages?
> 
> I need some time to answer this question.
> 
> I have successfully used tlsf for some time in different projects
> (e.g. I have used tlsf in my own version of PMON2000).
> 
> I have found that the barebox has an unusable menu "malloc type",
> there I have found only dmalloc (yes, I know, there is very simple
> malloc too). So I said to myself "Why not to add tlsf to this
> menu?"...

Yes, why not ;)

> 
> I have a reason, but, it is not very strict reason of course: tlsf is
> a more recent, and last updated May 2010.

I am generally open to a new malloc implementation. As said, the
possibility to have memory pools is very useful in some cases. dlmalloc
has newer versions though aswell and newer versions also have memory
pools, but...

> 
> > How is the binary size compared to dlmalloc?
> 
> The binary size is the same.

...Newer versions of dlmalloc are bigger in binary space.

A good selling point for this allocator might be that it's fast (if it
is)

Maybe we can give it a try. First we need a working memalign function of
course.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list