Skip to content

SD begin() end() memory leak #2897

Closed
@cybercatnet

Description

@cybercatnet

Hardware:

Board: ESP32 Dev Module DOIT
Core Installation version: 1.0.1
IDE name: Arduino IDE and Platform.io
Flash Frequency: 80Mhz
PSRAM enabled: no
Upload Speed: 115200
Computer OS: Windows 10

Description:

In my program i have memory leak and i made a simple test.
SD.end() doesnt free all of his heap memory.
My program needs to check if the sd card is connected before touch files, and if is not i need to SD.begin() again in the case of the sd card is again connected.

Sketch:

#include <SPI.h>
#include <SD.h>

void setup() {
Serial.begin(9600);
}

void loop() {
SD.begin(5);
Serial.println((unsigned long)ESP.getFreeHeap());
SD.end();
delay(1000);
}


### Debug Messages:

ESP.getFreeHeap:
249644
249624
249604
249584
249564
249544
249524
249504
249484
249464
249444
249424
249404
249384
249364
249344
249324
249304
249284
249264
249244
249224

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions