Index of /rez/jalloc
jalloc is a malloc replacement that I wrote for an embedded platform for a very particular application.
As such it is unsuitable for your needs. Feel free to use it!
I can't remember how it works, but it seems to. I have vague memories of representing blocks of memory as
bits in a bitmap and using lookup tables to find free regions of appropriate sizes.
To set up a new heap (a chunk of memory from which you can allocate from), use:
myHeap = new_heap (SIZE, BLOCK_SIZE);
In a very non-thread-safe fashion, jalloc keeps track of your current heap and subsequent calls will act
on the current heap. To alloc memory, substitute 'm' for 'j':
void *p = jalloc(size_t);
To switch your current heap, use:
set_arena(myOtherHeap);
You can also save and load heaps to disk. Nice.
In embedded applications you will want to replace the call to malloc in new_heap (jalloc.c:204 and jalloc.c:210)
with pointers to space in your device memory.
For a short time only, jalloc comes with some other features like jstrcmp!
Download here
Josh Reich
i2pi.com