-
Notifications
You must be signed in to change notification settings - Fork 13.3k
SPIFFS.end() does not free memory #4585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It appears SPIFFS doesn't have the functionality to free the cache and buffers it allocates.
Maybe someone who understands the allocation code can write a few lines that free it all in SPIFFS.end. Since SPIFFS is an external project to this, you may want to inquire at https://github.com/pellepl/spiffs . I also waited 30 seconds in the loop() before running the test, as internal wifi/OS bits tend allocate memory for the first 10 seconds at boot time. Its best to have the heap stable before measuring. |
Can you please provide me how to disable cache? I tried set
SDK 2.3.0, becase 2.4.1 randomly disconnects from wifi after like 2 to 4 hours and can not be used for long term usage. |
I got that error as well, so I just changed that line to:
I can't be sure this change won't cause any functionality issues, but it appears to work for me so far. |
Seems like it can not open file for read or write at all.. But for append yes, strange... |
For me the no-cache is working perfectly and I got a bunch of free heap as well. Note that I'm running git master, in case that influences the functionality. I've been able to create, write, read, append and delete files. Its slower, but working fine. Unless one of the maintainers plan on implementing a cache/buffer freeing feature, I'd say SPIFFS is working as designed and that a pull request should be done by someone who can implement it. I'll look into doing this if no one else does, as I'm now interested in having SPIFFS clean it self up better for the use case you mention, as well as a properly functioning no-cache option. |
I setup a fork at https://github.com/Eszartek/Arduino to work on implementing the freeing of SPIFFS memory resources as well as a "no cache" option for those folks that are memory contrained. |
Releases the buffers allocated by the SPIFFS object when/if SPIFFS::end() is called. Fixes esp8266#4585
When do SPIFFS.begin() it will consume some like 2kB of memory, but SPIFFS.end() will not release it. That is kinda problem for low-memory environment as for my application these 2kB is difference between SSL handshake can be done later or not.
Tested SDK: 2.3.0, 2.4.1 from Arduino IDE
Tested ESP_12E
Test code:
Sample output:
The text was updated successfully, but these errors were encountered: