Memory Optimizations

This commit is contained in:
2025-07-06 22:25:49 +02:00
parent fe04474ed8
commit 129fa8e624
13 changed files with 1426 additions and 543 deletions

View File

@@ -96,6 +96,11 @@ void DirectoryNode::buildDirectoryTree(const char *currentPath)
mp3Files.clear();
ids.clear();
// Reserve memory to reduce heap fragmentation (optimization 3)
subdirectories.reserve(8); // Reserve space for 8 subdirectories
mp3Files.reserve(16); // Reserve space for 16 MP3 files
ids.reserve(16); // Reserve space for 16 IDs
File rootDir = SD.open(currentPath);
while (true)
{