跳至主要内容

博客

Memory Leak Fixes and Stability Improvements Across WebView, Plugins, and RSS

功能MemoryWebView

In this optimization round, we tracked down multiple memory-growth paths and shipped targeted fixes across WebView, translation, plugin execution, and RSS processing.

In this update cycle, we investigated memory-growth reports from production, traced root causes across multiple modules, and shipped targeted fixes.

Key Optimizations

  1. WebView lifecycle cleanup

    • Fixed repeated window observer registration and ensured removal on close.
    • Reduced object retention in the WebView window lifecycle.
  2. Translation and popover memory cleanup

    • On popover teardown, translation tasks were canceled and in-memory translation state was cleared immediately.
  3. Plugin + RSS path optimization

    • Reused each plugin’s JavaScript runtime with cache pruning, execution locking, and immediate post-run memory cleanup.
    • Replaced parser-heavy RSS HTML stripping with a more efficient text-cleaning pipeline, reducing memory allocation during feed refresh.
    • Released large popover images from the memory cache on dismissal while preserving the disk cache.

Progress So Far

  • More stable memory behavior in long sessions.
  • Fewer retained objects after popovers and windows are closed.
  • Lower refresh-time memory pressure in plugin and RSS-heavy workflows.
  • More timely WebView memory reclamation after WebView/window teardown.

We are continuing this work with ongoing profiling, leak checks, and release-by-release refinements to resource cleanup in complex pages and plugin-heavy workflows.