Memory: Implement lazy commit for physical memory backing store (fixes Windows commit limit & enables Dreaming Sarah on original ROG Ally Z1 Extreme hardware) #238
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!238
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/238/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@necat101 on GitHub · 2026-08-12 03:34 UTC · original
necat101:main→main· +87 −1 · 4 files · 2 commits · closed without mergingThis PR resolves a critical memory management issue on Windows where the emulator would commit the entire 13.5 GiB physical memory backing store during startup, frequently hitting the system's commit limit before any game code could execute. The fix implements lazy page commitment, reducing initial committed memory from ~13.5 GiB to just ~16 KiB.
With this change, Dreaming Sarah (PPSA02929) is now playable at ~60 FPS with full input support, audio, and save/continue functionality.
The Problem
On Windows, VirtualAlloc with SEC_COMMIT was forcing the OS to reserve and commit the full 13.5 GiB of emulated physical memory at emulator launch. On systems with moderate RAM/commit limits, this would fail with error 0x5AF before the game could even reach the title screen. The existing error handling would report this as a generic "backing store unavailable" without clear diagnostic information.
The Fix
memoryAddressSpace.inc: Changed the backing section from SEC_COMMIT to SEC_RESERVE, then introduced lazy commitment of backing pages as guest memory accesses occur.
Error Handling: Added a distinct BackingCommitFailed diagnostic to differentiate commitment failures from other backing-store issues.
Memory Management: Extended memory.cpp and memory.h with supporting hooks to track and manage lazy commitment.
Tests: Added regression coverage in VirtualMemoryAllocationTests.cpp to verify lazy-commit behavior. The full virtual-memory test suite passes.
Result: The new test shows only 16 KiB committed at startup versus the previous 13.5 GiB.
Verification
Dreaming Sarah was exercised beyond the title screen to validate the fix and overall emulator stability:
✅ Title/menu renders correctly
✅ "New Game" enters successfully
✅ Intro sequence plays
✅ Forest gameplay renders correctly
✅ Character movement and camera scrolling work as expected
✅ Sustained ~60 FPS during gameplay probes
✅ SDL audio opens successfully at 48 kHz stereo
✅ Pause menu functions correctly
✅ In-game "Save" writes localStorage.json to _SaveData\PPSA02929\SAVEDATA00\
✅ Graceful shutdown completes without errors
✅ Relaunch enables "Continue"
✅ "Continue" restores saved forest state correctly
✅ No fatal, unsupported, unimplemented, or failure diagnostics observed during probes
@necat101 on GitHub · 2026-08-13 07:01 UTC · original
!bump
@Nmzik on GitHub · 2026-08-29 21:38 UTC · original
#390
Pull request closed