At what level does this message become a worry: Low memory available, stability problems may occur

I am trying to get my head around the level at which the subject compile-time message becomes an issue.
I am writing a sketch for the UNO part of a UNO with WiFi board (sorry Core - Jaycar XC4411).
The sketch was working fine so I started to “productionise” it. It was when I added a function to read a file on the SD card to get WiFi settings and pass them to the ESP part of the board that I had a problem. This function could not find the files despite the fact that a mini sketch that just did only this read and send worked fine.
I started commenting out other sections of the main sketch to try and work out when the problem began. I commented out everything that wasn’t directly involved in either the file read or a diagnostic serial output to Putty.
I got down to 45% of program storage space and 61% of dynamic memory and the file-read function worked perfectly. I then un-commented connected pieces of the code (library with associated declarations and executable code) and tested the file-reading function after each change.
I got as far as 57%/71% with the file-read still working perfectly. The next add-back step took the numbers to 61%/79% and it stopped working. The function that I un-commented had nothing to do with the file reading function. Calls to it were inside the “loop” function whereas the calls to the file file-read function were within the “setup” function so it was nothing to do with the actual execution of the re-added code. It was all about memory.
Does this say that when these numbers reach this sort of 60%/75% country, you are in trouble.
I very consciously declare everything globally as much as I can to avoid doubt about whether I have enough space but still this problem has occurred. How is the board consuming so much memory at run time?
Happy to share code if anyone thinks it will help but I hope the above description conveys the message.

2 Likes

There is no magic number - it depends on things like program structure (eg stack usage in function calls) and variable usage. There is quite a good discussion, with suggestions for how to monitor and diagnose, here:
Measuring Memory Usage | Memories of an Arduino | Adafruit Learning System

3 Likes