473,698 Members | 2,426 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Tha nks

May 8 '06 #1
3 10659

<bh******@gmail .com> wrote in message
news:11******** **************@ i39g2000cwa.goo glegroups.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.c om, 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/googlegroupsrep ly/>
May 8 '06 #4

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

Similar topics

4
3017
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 usual stuff like password, name... and I have Buddy List. I also have the following relation. Users "have a" Buddy List The cardinality is that a user can have one buddy list and one buddy list is associated with one user.
12
2478
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 Visual Studio. #include <malloc.h> #include <map>
3
2708
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 dynamic memory required for my datastructures ( used sizeof() to get the size of the structures ). But mallinfo() function show that approximately double that amount of memory is being allocated. I am working with gcc 3.2.2 on a redhat 9 machine. I...
27
2161
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, it took me a while to figure out how to get accumulate() to compile correctly: // begin and begin2 must both be input iterators.
14
2029
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
3171
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 following code that attempts to remove an item from the list: class shm_objptr_list : public std::list < void*, SharedMemAlloc<void * > {
13
5030
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 implement operator new/delete I can't see a way to indicate, on delete, how many objects must be destroyed (or how big the space is) - alternatively I can't figure out what are the alignment requirements so that the implementation, after calling my...
2
2168
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
2823
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
8609
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9166
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8899
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8871
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6525
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5861
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4371
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2333
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.