enhance: reduce runtime memory retention during exports and graph switching#12756
Open
megayu wants to merge 9 commits into
Open
enhance: reduce runtime memory retention during exports and graph switching#12756megayu wants to merge 9 commits into
megayu wants to merge 9 commits into
Conversation
megayu
commented
Jun 1, 2026
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.
Contributor
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.