OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Apr 25, 2024 4:30 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: easy to use memory allocator for single-threaded 64-bit OS
PostPosted: Sun Jul 12, 2020 3:55 am 
Offline
Member
Member

Joined: Sun May 24, 2020 9:11 am
Posts: 61
Location: /dev/null
Writing my operating system I have come to such a point that I have to use malloc. Unfortunately, I don't know how to start writing memory allocator at all, so I decided to integrate another one with my OS. liballoc looked cool and was easy to use. However, I saw a thread on this forum in which it was written that it doesn't work properly with 64-bit systems. Other allocators listed in this article - https://wiki.osdev.org/Memory_Allocation are difficult to integrate.

Are there any other easy to use memory allocators not mentioned in this article? I don't need it to be cool, it can even be slow, unstable and use a lot of memory, my OS doesn't even have multitasking yet. I just want it to be simple and easy to use.


Top
 Profile  
 
 Post subject: Re: easy to use memory allocator for single-threaded 64-bit
PostPosted: Sun Jul 12, 2020 4:12 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4594
Location: Chichester, UK
Both simple slab and buddy allocators are fairly easy to implement. Here's one link to a slab allocator implementation: http://3zanders.co.uk/2018/02/24/the-slab-allocator/

With a little Googling you can find other implementations and simple buddy allocators. This is a lot easier than it first appears to be. I'd recommend that you experiment with a simple application in Linux (or whatever your development platform is) allocating memory from a fixed array of bytes; you can then easily integrate it into your OS. That way you'll be able to run it in a debugging environment to ensure that it works correctly (and that you understand how it works).


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], Majestic-12 [Bot], RayanMargham and 210 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group