Hello Storage Forum!
I have a question about RAM usage while implementing SdFat instance.
Here is my test code
/* Print the free RAM after initializing SdFat in bare minimum program */
#include <MemoryFree.h>
#include <SdFat.h>
void setup()
{
Serial.begin(9600);
Serial.println(freeMemory());
SdFat card;
Serial.println(freeMemory());
pinMode(10, OUTPUT);
card.begin(10, SPI_FULL_SPEED);
Serial.println(freeMemory());
Serial.println( F("End of setup!") );
}
void loop()
{
Serial.println(freeMemory());
delay(1000);
}
And here is the output via Serial monitor, showing freeMemory() calls (in bytes).
1235
1235
1235
End of setup!
1296
1296
1296
1296
1296
1296
1296
I wonder why the code above shows 1235B free before the SdFat instance is initialized??
Without the SdFat calls I see 1823B free inside of setup() and 1825B free inside of loop().
And I wonder why the RAM used by SdFat instance is not cleared after setup() returns?
I appreciate your time. -ted