10000 Dynamically allocate the SD sector cache on use, save ~512 bytes when SD not used by earlephilhower · Pull Request #4204 · esp8266/Arduino · GitHub
[go: up one dir, main page]

Skip to content

Dynamically allocate the SD sector cache on use, save ~512 bytes when SD not used #4204

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

Closed
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix typo
  • Loading branch information
earlephilhower committed Nov 18, 2018
commit 8dcbf46e7ebcab4a69e9b72b8c3bf31f45e8d9c3
4 changes: 2 additions & 2 deletions libraries/SD/src/utility/SdFat.h
Original file line number Diff line number Diff line change
Expand Up @@ -439,8 +439,8 @@ class SdVolume {
}
/** Delete an instance of SdVolume */
~SdVolume() {
cacheBufferRefCnt--;
if (!cacheBufferRefCnt) {
cacheBufferRefCnt_--;
if (!cacheBufferRefCnt_) {
free(cacheBuffer_);
cacheBuffer_ = NULL;
}
Expand Down
2 changes: 1 addition & 1 deletion libraries/SD/src/utility/SdVolume.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
// raw block cache
// init cacheBlockNumber_to invalid SD block number
uint32_t SdVolume::cacheBlockNumber_ = 0XFFFFFFFF;
uint8_t SdVolume::cacheBufferRefCnt = 0; // No users of the object yet
uint8_t SdVolume::cacheBufferRefCnt_ = 0; // No users of the object yet
cache_t* SdVolume::cacheBuffer_ = NULL; // 512 byte cache for Sd2Card
Sd2Card* SdVolume::sdCard_; // pointer to SD card object
uint8_t SdVolume::cacheDirty_ = 0; // cacheFlush() will write block if true
Expand Down
0