My main code is crashing with using more than 20k. So I just did this simple test to check what whas happening with my RAM, without any Stack. My processor have 64k and I really need to use it for local variables and Serial Buffers. There is any way that can I use it all?
victor_pv wrote: ↑Thu Aug 31, 2017 2:49 amNot sure why you would need so many strings at the same time, but well that's off topic.
It's hard to say why your sketch is crashing, but besides the memory you assign for variables, there is also the Stack and the Heap in RAM.
They grow towards each other, so you can run in a situation where the Stack overwrites variables in the Heap, or the Heap overwrites data in the stack. Either case causes a corruption of memory and likely a crash.
I can't say how much memory you are using in either, but it you use a lot of "new" or "malloc" to alocate space for variables, that will come from the heap and can end up crashing with the stack.
On the other hand, if you have some code that nests functions calls a lot before unwinding it all, that will grow the stack a lot. Also if you declare objects that take a lot of ram, like those strings, as local, they take a lot of memory from the stack.