How to detect when no RAM left for a malloc? It seems to just keep going (Teensy 3.1)

Status
Not open for further replies.
estack is static, the very top of the RAM. IMO, basing the amount of reserved stack on the current stack size (stack pointer) doesn't make sense.
 
thinking about it, you're probably correct that a static stack frame is good enough, expecially if it is, as in your patch, configurable.
I was wondering if there's a way to include "-fstack-usage" in the Arduino build process to actually be able to make an informed decision on stack frame size.
Over the last two weeks, I was working with the Teensy audio library a bit and I have run into quite a few crashes that probably were just memory overrunning the stack...

Thanks

pj
 
I was wondering if there's a way to include "-fstack-usage" in the Arduino build process to actually be able to make an informed decision on stack frame size.
You can set STACK_MARGIN.

E.g. change "arduino/hardware/teensy/avr/boards.txt" and add "-DSTACK_MARGIN=..." to the build flags for your Teensy.
 
Status
Not open for further replies.
Back
Top