diff --git a/lib/Epub/Epub.cpp b/lib/Epub/Epub.cpp index 0f38f566..13b4885e 100644 --- a/lib/Epub/Epub.cpp +++ b/lib/Epub/Epub.cpp @@ -351,6 +351,11 @@ bool Epub::load(const bool buildIfMissing, const bool skipLoadingCss) { Storage.removeDir((cachePath + "/sections").c_str()); } } + // Release the resolved CSS rule map: it is only needed transiently while building + // section caches, and createSectionFile reloads it from cache on demand. Holding it + // resident pins tens of KB for the whole reading session (more on warm resume into + // an already-cached chapter, where createSectionFile never runs to clear it). + cssParser->clear(); LOG_DBG("EBP", "Loaded ePub: %s", filepath.c_str()); return true; }