From d22a03efcd0aeddaa7d0d2ca47bd345f6ecf7752 Mon Sep 17 00:00:00 2001 From: Takoroka <137927095+Takoroka@users.noreply.github.com> Date: Fri, 30 Oct 2026 00:54:09 -0400 Subject: kernel: clear the fastmem arena when the application process is closed Loading a Switch 2 game after another one in the same window hung or crashed it at boot. The first game's process still had 55-60 references at kernel shutdown, so it was never finalized and its memory stayed mapped in the fastmem arena. The next game's mappings at the same addresses then failed ("Failed to split placeholder" / "Failed to map placeholder"), and it ran on the first game's memory: Mario Kart World loaded after another Switch 2 game jumped to a garbage address from rtld, or hung. Detach the closed process from the arena (a late finalize must not unmap the next game's memory), unmap the whole arena, and log when the process was still referenced. --- src/common/host_memory.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/common') diff --git a/src/common/host_memory.h b/src/common/host_memory.h index a7fd0532b7..8747a1850f 100644 --- a/src/common/host_memory.h +++ b/src/common/host_memory.h @@ -68,6 +68,10 @@ public: return virtual_base; } + [[nodiscard]] size_t VirtualSize() const noexcept { + return virtual_size; + } + bool IsInVirtualRange(void* address) const noexcept { return address >= virtual_base && address < virtual_base + virtual_size; } -- cgit v1.2.3