What's New: Storefront Memory Conductor
Storefront now includes a built-in Memory Conductor (storefront_conductor) that coordinates background tasks, fork() subprocesses, and cache eviction across all installed KOReader plugins—preventing Kindle's memory watchdog and Linux OOM killer from terminating KOReader when multiple plugins run simultaneously.
Key Features
- Automatic Cross-Plugin Protection (Zero Configuration):
- Background Timer Serialization: Transparently wraps
UIManager:scheduleInandunscheduleto serialize background plugin timers into a single-lane priority queue, preventing startup, wake, and Wi-Fi reconnect stampedes. Foreground UI actions, core KOReader timers, micro-timers (<= 0.25s), and active subprocess pollers continue with zero delay. - Pre-
fork()Copy-On-Write Stabilization: Wrapsffiutil.runInSubProcess,isSubProcessDone, andterminateSubProcessto reclaim soft caches and flush LuaJIT GC debt before any plugin forks a child process, preventing parent-process CoW RAM duplication while background workers run. - Kindle-Aware
/proc/meminfoThresholds: Accurately accounts forShmemon legacy Kindle kernels (Linux 3.0) and enforces safe RAM floors (45 MBsoft /28 MBcritical on<= 512 MBdevices) before dispatching background work.
- Background Timer Serialization: Transparently wraps
- Developer API & Event Protocol (Zero Hard Dependency):
- Level 1 (
MemoryReclaimEvent): Plugins can implementfunction MyPlugin:onMemoryReclaim(level)to shed private in-memory caches on demand without importing Storefront. - Level 2 (
storefront_conductorAPI): Plugins can request priority-managed execution slots (foreground,interactive_bg,idle_bg) viapcall(require, "storefront_conductor")withConductor.requestSlot(),Conductor.registerPlugin(),Conductor.reclaimMemory(), andConductor.getMemoryStatus().
- Level 1 (
Documentation
- Full architecture details, standalone fallback templates, and API reference: Memory Conductor & Developer API (Wiki)
Full Changelog: 26.11.20...26.11.21-beta