473,385 Members | 1,655 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

code for implementing buddy allocator

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

May 8 '06 #1
3 10644

<bh******@gmail.com> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
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
May 8 '06 #2
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

May 8 '06 #3
bh******@gmail.com wrote:

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/>
May 8 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: David | last post by:
I am creating a web community site where each user can have a list of buddies. I have struck a bit of a problem though. I am designing my db model and have two entities called users containing...
12
by: Paul | last post by:
Hi, Global operator new and delete are overloaded and I am using stl map to store pointers, but this code crashes, can some one shed some light??? Compiler: MS VC++ 6.0 STL: Shipped with...
3
by: Sourin | last post by:
Hi all, I am trying to write code for my experiments. My work involves huge datasets, and as such my code needs to be memory efficient. I did some hand calculations regarding the amount of...
27
by: Pete | last post by:
I'm doing exercise 8-2 from "Accelerated C++" where we're supposed to implement library algorithms, trying to minimize the number of iterator operations. I have two questions so far. First,...
14
by: Gary Wessle | last post by:
Hi I wrote this routine below but getting the error below it which I don't know how to fix. thanks //useful.h /**
5
by: fimarn | last post by:
I am trying to get rid of compile time error that I am getting only in RHEL5 (not in RHEL4) apparently due to the changes in the stl_list.h file. The error that I am getting is coming from the...
13
by: Tristan Wibberley | last post by:
Hi I've got implementing overloaded operator new and delete pretty much down. Just got to meet the alignment requirements of the class on which the operator is overloaded. But how does one...
2
by: Pallav singh | last post by:
Can we implement generic container like vector and set in shared memory region ( we get from Linux system calls shmget( ) , shmat( ) ) ?? i am facing problem in that ?
3
by: vrsathyan | last post by:
Hi.., While executing the following code in purifier.., std::vector<int> vecX; vecX.clear(); int iCount = 0; { int iVal;
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.