I have several heaps defined to differentiate blocks of internal RAM and external RAM for various uses. It appears I cannot use all of the heap area. I know there is overhead in establishing the heap and for each heap allocate. I am not concerned with that. What appears to be happening is I cannot allocate a block that is within 108 bytes of the end of the heap. I have the following code for my final allocation in my internal heap:
internal_heap = heap_lookup(2);
size = heap_space_remaining(internal heap); // returns with size = 284
buffer = new(internal_heap) s32; // Works if size is 42
size = heap_space_remaining(internal heap); // returns with size = 108
The above code fails with kNewFailure if the allocation is increased to 43 instead of 42. Is there a reason for this failure?
My final allocation wants to be 48 32-bit values which should fit with some room to spare including the overhead of 8 bytes.
Any help is appreciated.