Instability: program storage space or just dynamic memory?

Hi all,
I've seen that if the dynamic memory usage is too big that may cause instability.
Also the Program storage space usage may cause instability? If yes why?

PS: what are the threasolds for the instability issue? 90%?

Markino76:
PS: what are the threasolds for the instability issue? 90%?

you really cannot say because it depends a lot on your use of local variables.

are you having a problem with a specific piece of code?

Yes, I had problems and after some optimizations (F() as first!) now I think I'm running fine but I'd like to prevent and optimize as much as I can.

What about my first question? Is storage space cause of instability?

Markino76:
Yes, I had problems and after some optimizations (F() as first!) now I think I'm running fine but I'd like to prevent and optimize as much as I can.

What about my first question? Is storage space cause of instability?

Your program, stored in FLASH, will either fit or not fit.

Instability is really a measure of how well you use your RAM and your programming in general.

Ok, thanks for your response!
So If I understood well I just have to pay attention on the Dynamic Memory usage.
The storage memory may goes up to 99% with no instability, correct?

microcontroller systems generally allow you to change the heap and stack allocation sizes

Markino76:
Ok, thanks for your response!
So If I understood well I just have to pay attention on the Dynamic Memory usage.

And stack usage -- that's determined by local variables and parameters passed to/from functions.

Ok, I got it!

Is there a way to monitoring the dynamic memory and stack while running the sketch?

Markino76:
Ok, I got it!

Is there a way to monitoring the dynamic memory and stack while running the sketch?

yes there are tools like this, but of course, they use more RAM. :wink: