Once every few months, X fills up SPIFFS. When that happens, my software prunes older data from the log.
To do this, I:
- create String S
- copy only the newer half of file X into string S
- dump S into a new file, Y
- then I delete X, using Y as the new log
This code is working great for me, but...
I am concerned that one day for unforeseen reasons my available memory (stack?) could be less than the size of S. Boom, overflow.
Is there a way to ensure S won't overflow the stack? Could I check for free memory, thereby limiting data into S?
I could just appendFile(), byte by byte, from X to Y, without using S. But...
I also serve S in a webpage for users to view the log:
Code: Select all
server.send(200, "text/html", S);