Skip to content

enhance: reduce runtime memory retention during exports and graph switching#12756

Open
megayu wants to merge 9 commits into
masterfrom
enhance/reduce-runtime-memory
Open

enhance: reduce runtime memory retention during exports and graph switching#12756
megayu wants to merge 9 commits into
masterfrom
enhance/reduce-runtime-memory

Conversation

@megayu

@megayu megayu commented Jun 1, 2026

Copy link
Copy Markdown
Collaborator
  • Revoke generated Blob/Object URLs on replacement, graph switch, and pagehide.
  • Clear query/async-query/worker graph caches on graph switch.
  • Add bounded LRU for inactive reactive query cache.

@github-actions github-actions Bot added the :type/enhancement Enhancement to product. Does not affect the overall basic use. label Jun 1, 2026
@megayu megayu requested a review from Copilot June 1, 2026 08:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to reduce runtime memory retention across exports and graph switching by revoking Blob/Object URLs, clearing query caches on graph switch (including worker-side caches), and bounding reactive query caching with an LRU-style eviction strategy.

Changes:

  • Added object URL revocation on replacement and pagehide, and wired revocation into export/download flows.
  • Cleared reactive query state, async query cache, Pixi graph instance state, and worker query caches during graph switching.
  • Introduced bounded cache behavior for inactive reactive queries and reduced worker-side title cache size.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/main/frontend/worker/db_core.cljs Bounds page-title cache and adds a thread API to clear worker-side query caches.
src/main/frontend/utils.js Tracks created object URLs for downloads and revokes them on replacement and pagehide.
src/main/frontend/util.cljc Ensures image blob conversion revokes object URLs and clears canvas/image references.
src/main/frontend/image.cljs Adds a centralized object-URL manager for CLJS (create/revoke/revoke-all, pagehide cleanup).
src/main/frontend/handler/export/text.cljs Uses frontend.image replacing object URLs for markdown zip downloads.
src/main/frontend/handler/export.cljs Uses frontend.image replacing object URLs for zip/sqlite downloads.
src/main/frontend/handler/events.cljs Clears query caches and revokes tracked object URLs on graph switch; destroys Pixi instance.
src/main/frontend/handler/assets.cljs Routes asset blob URL creation through frontend.image for later cleanup.
src/main/frontend/extensions/graph/pixi.cljs Resets additional Pixi-related cache on destroy.
src/main/frontend/db/react.cljs Adds bounded eviction for inactive query cache and tracks last-access timestamps.
src/main/frontend/db/async/util.cljs Adds bounded async-query cache tracking and exposes cache clearing.
src/main/frontend/db/async.cljs Re-exports async query cache clearing API.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/main/frontend/utils.js
Comment thread src/main/frontend/handler/events.cljs
Comment thread src/main/frontend/db/react.cljs
@megayu megayu requested review from RCmerci, tiensonqin and xyhp915 June 1, 2026 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:type/enhancement Enhancement to product. Does not affect the overall basic use.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants