Drop-in memory routines/slab allocator.

Programming, for all ages and all languages.
Post Reply
durand
Member
Member
Posts: 193
Joined: Wed Dec 21, 2005 12:00 am
Location: South Africa
Contact:

Drop-in memory routines/slab allocator.

Post by durand »

Hi,

I've put my slab allocator code up for some comments, suggestions and for other people to use.

Download here: http://www.djm.co.za/liballoc/liballoc.tar.gz


I'm basing it on the following paper: http://www.usenix.org/event/usenix01/bonwick.html.
It details the vmem and slab allocator subsystems of the Solaris kernel. But I've only implemented the slab allocator in roughly the same way they have. Nothing special.

To use the routines in your system, you just need to implement 4 functions: 2 locking functions + 2 paging functions. If your system is single-threaded, you just need to implement the 2 paging functions.

I've been doing some tests. For simple and continuous malloc/free pairs, the library generally runs faster than the default gcc implementation. For actual use, it's relatively close to gcc's implementation. OpenOffice only takes an extra 1-2 seconds to load if you use my library. Less complex applications are not noticable.

It's a work in progress but it works now and if you need a malloc/free implementation, then my library will only take a few minutes to implement on your system.

Please can people give me some feedback and suggestions.

Like I said, I'm going to keep improving it.
Post Reply