Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(persisted-scope): Prevent memory leaks, fixes #274 #328

Merged
merged 17 commits into from
Apr 26, 2023

Conversation

FabianLars
Copy link
Member

It's not actually a memory leak the plugin just breaks the .persisted-scope file, bloating it up (to 100mb after a few uses/restarts if you actually use the scope) to a point where it gets too large to work correctly.

This PR adds more pattern than strictly necessary to fix existing files seamlessly - well, hopefully at least.

Fixes #274

@FabianLars FabianLars requested a review from a team as a code owner April 24, 2023 13:27
@FabianLars
Copy link
Member Author

We may have to look into deleting files that are too large before reading them in the future because some users reported OOM crashes. In the PR tests Windows didn't report any memory usage raise when reading a 50MB, but no idea if Rust just handles this extremely well or if Windows just doesn't want to report it in time (even though it has like 5 secs lol)

Edit: Tested it with the current dev branch and Windows does report the insane memory usage correctly so maybe Rust is indeed doing a great job here 👀
Edit2: Yes, both of these edits were added before i initially posted this comment 😂

@FabianLars FabianLars merged commit ebb2eb2 into dev Apr 26, 2023
@FabianLars FabianLars deleted the fix/persisted-scope-memory-leak branch April 26, 2023 10:37
This was referenced Apr 26, 2023
OrIOg pushed a commit to OrIOg/plugins-workspace that referenced this pull request Jun 25, 2023
 (tauri-apps#328)

* fix(persisted-scope): Unescape paths before saving to disk.

* fix cfg flags

* dedupe code

* unescape when reading to try to fix existing files

* add more patterns. only fix pattern on app start. don't check if pattern is allowed already.

* remove dbg log

* typo

* remove unused imports

* clippy

* fix compilation with asset-protocol feature flag enabled

* update patterns

* manually re-save state once

* add changefile

* remove dbg print
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.

[persisted-scope] Memory leak in tauri-plugin-persisted-scope
1 participant