code for implementing buddy allocator

B

bharmaji

Hi
I am wondering if there is freely available code for a buddy memory
allocator. Specifically I am looking for code that will can break the
blocks across multiple levels and then merge them back together eg.
if the memory pools are 32k, 16k , 8k in size, then
a) if both 8K and 16K are exhausted and application asks for 8k block,
32 K should be broken into 16K fragments and then again into 8K(i.e.
the blocks are broken across multiple levels not just from 16K to 8K)
b) Whenever memory is released the blocks should be merged into 16K and
then back into 32K

Any suggestions will be appreciated.Thanks
 
R

Rod Pemberton

Hi
I am wondering if there is freely available code for a buddy memory
allocator. Specifically I am looking for code that will can break the
blocks across multiple levels and then merge them back together eg.
if the memory pools are 32k, 16k , 8k in size, then
a) if both 8K and 16K are exhausted and application asks for 8k block,
32 K should be broken into 16K fragments and then again into 8K(i.e.
the blocks are broken across multiple levels not just from 16K to 8K)
b) Whenever memory is released the blocks should be merged into 16K and
then back into 32K

I'm not sure if these will help. Doug Lea and John Walker have both written
respectable memory allocators. Although, recent information indicates
dlmalloc may perform better:

Doug Lea's dlmalloc
http://gee.cs.oswego.edu/dl/html/malloc.html

John Walker's BGET
http://www.fourmilab.ch/bget/


Rod Pemberton
 
P

Paul Barker

I am working on this currently (for my physical memory manager), and
when it is done it will be merged into my subversion tree at
http://sourceforge.net/projects/xarnos. License will be MIT.

If thats good enough for you would you like an email when it's done? As
this is free software I'm making no guarentees it will ever actually
happen, but I'm getting there slowly :) .

HTH,
Paul Barker
 
C

CBFalconer

I am wondering if there is freely available code for a buddy memory
allocator. Specifically I am looking for code that will can break the
blocks across multiple levels and then merge them back together eg.
if the memory pools are 32k, 16k , 8k in size, then
a) if both 8K and 16K are exhausted and application asks for 8k block,
32 K should be broken into 16K fragments and then again into 8K(i.e.
the blocks are broken across multiple levels not just from 16K to 8K)
b) Whenever memory is released the blocks should be merged into 16K and
then back into 32K

It's not a buddy system, but has most of the characteristics you
specify. Take a look at nmalloc for DJGPP, available at:

<http://cbfalconer.home.att.net/download/nmalloc.zip>

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
Also see <http://www.safalra.com/special/googlegroupsreply/>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,127
Latest member
CyberDefense
Top