From d8139e9605d8d35caaa2e626dc53c328e83853c3 Mon Sep 17 00:00:00 2001 From: hooligan333 <59103913+hooligan333@users.noreply.github.com> Date: Sat, 11 Jul 2026 19:59:31 -0700 Subject: [PATCH] perf: release CSS rule map after warm open (#2439) Co-authored-by: Erica Jensen --- lib/Epub/Epub.cpp | 5 +++++ 1 file changed, 5 insertions(+) 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; }