I am writing firmware for the Atmel XMEGA microcontroller in c, and I think I filled 4k SRAM. As far as I know, I only have static / global data and local stack variables (I don't use malloc in my code).
I use a local variable to buffer some pixel data. If I increase the buffer to 51 bytes, strange results will appear on my display - a buffer of 6 bytes works fine. That's why I think my ram is full and the stack is rewriting something.
Creating more free memory is not my problem, because I can just move some static data into flash memory and load it only when necessary. My concern is the fact that I could never find out that the memory is full.
Is it possible to somehow cut (for example, by reselling the microcontroller) when the memory is full, instead of allowing it to overwrite some other data?
source
share