From 4c714d54f2b3a51cb9b7be7e9d5c3ecf55f6f090 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=9A=93?= Date: Mon, 12 Feb 2024 22:36:38 -0500 Subject: [PATCH] Cache eviction (#103) * fix: clear graphics caches when unloading projects * fix: set max memory to 4 GiB in web builds instead of 1 GiB --- .cargo/config.toml | 2 ++ crates/core/src/lib.rs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.cargo/config.toml b/.cargo/config.toml index 77777bb8..22ba68aa 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -19,6 +19,8 @@ rustflags = [ "--cfg=web_sys_unstable_apis", "-C", "target-feature=+atomics,+bulk-memory,+mutable-globals", + "-C", + "link-arg=--max-memory=4294967296", "-Z", "threads=8", ] diff --git a/crates/core/src/lib.rs b/crates/core/src/lib.rs index 7f197a57..950a1174 100644 --- a/crates/core/src/lib.rs +++ b/crates/core/src/lib.rs @@ -404,6 +404,8 @@ impl<'res> UpdateState<'res> { self.edit_windows.clean(|w| !w.requires_filesystem()); self.edit_tabs.clean(|t| !t.requires_filesystem()); self.audio.clear_sinks(); // audio loads files borrows from the filesystem. unloading while they are playing is a crash + self.graphics.atlas_loader.clear(); + self.graphics.texture_loader.clear(); self.filesystem.unload_project(); *self.project_config = None; self.data.unload();