Page 1 of 1

C Allocator for flat memory console system

Posted: Tue Aug 05, 2008 4:51 am
by AndrewAPrice
I'm looking for a decent C memory allocator for my console. I've done research and know of a few memory allocators (liballoc, dlalloc coming to mind) but they require that an operating system or an overlord (lack of a better word :)) to provide pages to use. I know I could fake paging easily using a simple bitmap, but I was wondering if there was a mature allocator which was designed to work with flat memory addressing without the extra overhead.

In the BEST case situation, I'd like a system where I can say "use memory 1MB to 24MB for malloc, use memory 24MB to 4GB for hmalloc (hardware malloc)", but I know it won't be that easy (I'm thinking I'll need two memory allocators working simultaneously).

Re: C Allocator for flat memory console system

Posted: Tue Aug 05, 2008 5:31 am
by JamesM
Hi,

Dlmalloc doesn't require paging. The stock dlmalloc.c just requires one function from the kernel iirc - sbrk (it can use mmap too). Sbrk is of course perfect for a linear address space. It should just work "out of the box" for you.

Cheers,

James