Common/MemArena: mmap returns MAP_FAILED on error, not nullptr.
This commit is contained in:
parent
a20bb3e05b
commit
c14bc6ea4c
|
@ -156,7 +156,7 @@ void* LazyMemoryRegion::Create(size_t size)
|
||||||
ASSERT(!m_memory);
|
ASSERT(!m_memory);
|
||||||
|
|
||||||
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, -1, 0);
|
||||||
if (!memory)
|
if (memory == MAP_FAILED)
|
||||||
{
|
{
|
||||||
NOTICE_LOG_FMT(MEMMAP, "Memory allocation of {} bytes failed.", size);
|
NOTICE_LOG_FMT(MEMMAP, "Memory allocation of {} bytes failed.", size);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
|
@ -122,7 +122,7 @@ void* LazyMemoryRegion::Create(size_t size)
|
||||||
ASSERT(!m_memory);
|
ASSERT(!m_memory);
|
||||||
|
|
||||||
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, -1, 0);
|
||||||
if (!memory)
|
if (memory == MAP_FAILED)
|
||||||
{
|
{
|
||||||
NOTICE_LOG_FMT(MEMMAP, "Memory allocation of {} bytes failed.", size);
|
NOTICE_LOG_FMT(MEMMAP, "Memory allocation of {} bytes failed.", size);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
Loading…
Reference in New Issue