diff options
| author | lizzie <lizzie@eden-emu.dev> | 2026-06-25 00:11:36 +0200 |
|---|---|---|
| committer | crueter <crueter@eden-emu.dev> | 2026-06-25 00:11:36 +0200 |
| commit | 6bdb03d8ac5a626256e52e4601fae9d245405345 (patch) | |
| tree | 476ca3025d15dd69f08932ea7b0f01a5fb4b1d00 /src/common | |
| parent | 599ab16288169d93595718c8f73717c96bc6ad00 (diff) | |
[common/virtual_buffer] Fix Windows on Snapdragon 7C realizing virtual pages before they're needed (#4128)
This should fix Windows devices with low RAM like 4GB, or anything lower than 8GB.
Signed-off-by: lizzie <lizzie@eden-emu.dev>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4128
Reviewed-by: Maufeat <sahyno1996@gmail.com>
Reviewed-by: MaranBr <maranbr@eden-emu.dev>
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/virtual_buffer.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/common/virtual_buffer.cpp b/src/common/virtual_buffer.cpp index 55ddfc243a..8a4265e3e6 100644 --- a/src/common/virtual_buffer.cpp +++ b/src/common/virtual_buffer.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project @@ -17,7 +17,11 @@ namespace Common { void* AllocateMemoryPages(std::size_t size) noexcept { #ifdef _WIN32 - void* base = VirtualAlloc(nullptr, size, MEM_COMMIT, PAGE_READWRITE); + void* base = VirtualAlloc(nullptr, size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); + if (base == nullptr) { + // Probably failing to reserve is less likely than failing to commit + base = VirtualAlloc(nullptr, size, MEM_COMMIT, PAGE_READWRITE); + } #else void* base = mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0); if (base == MAP_FAILED) |
