Browse Source

[common/virtual_buffer] Fix Windows on Snapdragon 7C realizing virtual pages before they're needed

Signed-off-by: lizzie <lizzie@eden-emu.dev>
pull/4128/head
lizzie 13 hours ago
parent
commit
6262f8e1db
  1. 6
      src/common/virtual_buffer.cpp

6
src/common/virtual_buffer.cpp

@ -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)

Loading…
Cancel
Save