With the subtle hints provided in the comments about not using malloc, I just ended up creating something to allocate my own memory. I don't ever need to release it so that made it simple. Only thing that stung me for about an hour was maintain the 32 bit alignment.
Here's my implementation pm_ stands for poor mans.
#define HEAPSIZE 0x800 //2K
uint16_t __heapPtr = 0;
uint8_t __customHeap[HEAPSIZE];
void *pm_malloc(uint16_t size){
while(__heapPtr % 4 != 0)
__heapPtr++;
void *block = &__customHeap[__heapPtr];
if(size + __heapPtr > HEAPSIZE)
return 0;
__heapPtr += size;
return block;
}
My life has been C#, Java and Objective-C for the past 15 years, so any feedback would be appreciated.