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.
I'm working on a project that should not use a Heap. In the process of revising my code for this, I've discovered that dynamically-sized arrays, e.g.
uint8_t my_array[MIN(input_size, MAX_SIZE)];
are automatically compiling into usages of malloc(). I've completed my code revision, but I have two questions:Where is this behavior is documented?Is it possible to change this so that the allocations instead happen on the Stack?
Hi,
Arm Compiler 5 would use the heap for this allocation: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0472m/chr1359124223721.html
Arm Compiler 6 would use the stack.
Paul.
You haven't said what version of Compiler you're using.
Would it not be simpler/safer to just make the size fixed?