Ive written a number of memory managers over the last 6 months, but I think I have found the perfect Jesusonic memory manager design. The Heman import library is a general purpose heap manager for Jesusonic.
Update: 27th Oct 2015 – Added _recalloc() and more code documentation.
This is my latest heap manager for Jesusonic. This implementation is a general purpose heap manager, which means it can be used for memory, strings, images and fonts.
The code includes common ANSI C memory functions. ie: malloc(), calloc(), realloc(), free() & _msize().
Ive included a testing app. The code works with Jeez and I’m currently working on a full GUI component library using allocated memory. Please contact me if you find any issues.
The heap manager stores a list of free spaces ordered by the starting pointer of the space. Heap information is stored in named strings. Each record is 8 bytes (chars) in size. ie: Each record is two 32 integers. The first is the size of the free space. The second is the pointer (base) of the free space. Due to a bug in str_delsub(), the first char of the string must not be used.