We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Simple question probably..
I have define my heap in the startup.s Heap_Size EQU 0x00001032
In a function I use: void SST25_EditEXTStr(...) { unsigned char *buffer;
buffer = malloc(0x1000);
if (buffer != NULL) {
//do my stuff
free(buffer);
} }
How come I can not set my Heap_Size to 0x00001000. If I do the buffer will be NULL
Thnx
Thank you for your reply.
I have tried to minimalize the heap size by trie and error :-S and a oversize of 32 bytes was the minimun on which it still worked.
My conclusion was the same as yours, I hope someone can tell me how much overhead it uses per malloc().
I now think I have to use 32bytes extra on every malloc()
meaning: buffer = malloc(0x100); buffer = malloc(0x1000);
needs a heap_size of 0x1164.
could this be correct? Or am I thinking crappy..
0x1164 would represent an overhead of 0x64 which in decimal is 100 bytes.
But do you really need a heap? Can't your program perform static allocations on startup, i.e. normal zero-initialized variables of potentially large size? Then you will not need any overhead at all, and the linker will not need to link in the heap code.