Skip to content
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

SPIFFS.end() does not free memory #1

Open
Eszartek opened this issue Apr 5, 2018 · 0 comments
Open

SPIFFS.end() does not free memory #1

Eszartek opened this issue Apr 5, 2018 · 0 comments

Comments

@Eszartek
Copy link
Owner

Eszartek commented Apr 5, 2018

As per @petrkr: 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:

// Filesystem
#include "FS.h"

void printHeap() {
  Serial.print(F("Heap size: "));
  Serial.println(ESP.getFreeHeap());
}

void setup() {
  Serial.begin(115200);
  delay(1000);
  Serial.println();
  Serial.println("Setup begin");
  Serial.print(F("SDK: ")); Serial.println(ESP.getSdkVersion());
  Serial.print(F("Core: ")); Serial.println(ESP.getCoreVersion());
  
  printHeap();
  
  Serial.println("SPIFF BEGIN");
  SPIFFS.begin();
  printHeap();

  Serial.println("SPIFF END");
  SPIFFS.end();
  printHeap();

  Serial.println("Setup end");
}

void loop() {
  Serial.println("Loooop");
  Serial.println("SPIFF BEGIN");
  SPIFFS.begin();
  printHeap();
  
  delay(1000);
  
  Serial.println("SPIFF END");
  SPIFFS.end();
  printHeap();

}

Sample output:

Setup begin
SDK: 1.5.3(aec24ac9)
Core: 2_3_0
Heap size: 47072
SPIFF BEGIN
Heap size: 44960
SPIFF END
Heap size: 44960
Setup end
Loooop
SPIFF BEGIN
Heap size: 44960
Setup begin
SDK: 2.2.1(cfd48f3)
Core: 2_4_1
Heap size: 47160
SPIFF BEGIN
Heap size: 44984
SPIFF END
Heap size: 44984
Setup end
Loooop
SPIFF BEGIN
Heap size: 44984
SPIFF END
Heap size: 44296
Loooop
SPIFF BEGIN
Heap size: 44296
SPIFF END
Heap size: 44224
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant