Page 1 of 1

Heap for first MB

Posted: Sat Dec 15, 2012 12:41 pm
by AlfaOmega08
Hi, I'm trying (just for fun, not a serious project) to write a boot manager.
With some copy/paste I get to protected mode from fat12 in half an hour...

Anyway I now need some sort of heap. Having malloc/free - new/delete is always good.
I usually use dlmalloc. However dlmalloc is HUGE. I would need something that:
  • Is lightning fast (today boot must be fast, and no bottleneck is accepted)
  • Is small
  • Supports for aligned mallocs (for page tables/directories)
  • Doesn't need paging
  • Can handle reserved zones (between 0x500 and 0x7FFFF there is 0x7C00 and I want to keep it safe)
I may use upper memory for the heap, but it's not safe, since the OS executable may be loaded anywhere over the first MB, thus overwriting the heap.

Any suggestion for such a memory allocator? Any dlmalloc configuration? Or just an idea of how to implement it...
Thanks in advance.

Re: Heap for first MB

Posted: Sat Dec 15, 2012 1:20 pm
by Griwes
For bootloader just use simple placement allocator, aware of those special regions - it's not like you're going to do much allocations in the bootloader.

Re: Heap for first MB

Posted: Sun Dec 16, 2012 1:16 am
by zeusk
Although I am not working on a bootloader, a small/fast heap without the requirement of paging would be nice for embedded purposes. Do post here if you find anything interesting.