Skip to content

Commit

Permalink
Common/MemArena: Set MAP_NORESERVE in LazyMemoryRegion on Linux.
Browse files Browse the repository at this point in the history
  • Loading branch information
AdmiralCurtiss committed Sep 10, 2023
1 parent 1a0f0e7 commit 606aa59
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Source/Core/Common/MemArenaUnix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ void* LazyMemoryRegion::Create(size_t size)
if (size == 0)
return nullptr;

void* memory = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
void* memory =
mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE, -1, 0);
if (memory == MAP_FAILED)
{
NOTICE_LOG_FMT(MEMMAP, "Memory allocation of {} bytes failed.", size);
Expand All @@ -142,7 +143,7 @@ void LazyMemoryRegion::Clear()
ASSERT(m_memory);

void* new_memory = mmap(m_memory, m_size, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0);
MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE | MAP_FIXED, -1, 0);
ASSERT(new_memory == m_memory);
}

Expand Down

0 comments on commit 606aa59

Please sign in to comment.