Skip to content

Quality: Missing URL.revokeObjectURL in FileSaver.js causes memory leak#1165

Open
tomaioo wants to merge 1 commit into
increpare:masterfrom
tomaioo:improve/quality/missing-url-revokeobjecturl-in-filesaver
Open

Quality: Missing URL.revokeObjectURL in FileSaver.js causes memory leak#1165
tomaioo wants to merge 1 commit into
increpare:masterfrom
tomaioo:improve/quality/missing-url-revokeobjecturl-in-filesaver

Conversation

@tomaioo

@tomaioo tomaioo commented Jun 15, 2026

Copy link
Copy Markdown

Summary

Quality: Missing URL.revokeObjectURL in FileSaver.js causes memory leak

Problem

Severity: Medium | File: src/js/FileSaver.js:L4

The saveAs function in FileSaver.js creates a Blob URL with URL.createObjectURL() but never revokes it with URL.revokeObjectURL(). This causes memory leaks, especially problematic if the function is called frequently to save files.

Solution

Store the URL in a variable and revoke it after the download is triggered, or use a setTimeout to revoke after a short delay: setTimeout(() => URL.revokeObjectURL(url), 0);

Changes

  • src/js/FileSaver.js (modified)

The saveAs function in FileSaver.js creates a Blob URL with URL.createObjectURL() but never revokes it with URL.revokeObjectURL(). This causes memory leaks, especially problematic if the function is called frequently to save files.

Signed-off-by: tomaioo <203048277+tomaioo@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant