C Allocator for flat memory console system

Programming, for all ages and all languages.
Post Reply
User avatar
AndrewAPrice
Member
Member
Posts: 2299
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

C Allocator for flat memory console system

Post 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).
My OS is Perception.
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Re: C Allocator for flat memory console system

Post 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
Post Reply