- fixed crash on JIT allocations over 1 MB

https://forum.zdoom.org/viewtopic.php?t=64383
This commit is contained in:
alexey.lysiuk 2019-04-27 14:36:20 +03:00
parent 5f871b7aa0
commit dd7ec1fe44

View file

@ -55,8 +55,9 @@ static void *AllocJitMemory(size_t size)
} }
else else
{ {
const size_t bytesToAllocate = MAX(size_t(1024 * 1024), size);
size_t allocatedSize = 0; size_t allocatedSize = 0;
void *p = OSUtils::allocVirtualMemory(1024 * 1024, &allocatedSize, OSUtils::kVMWritable | OSUtils::kVMExecutable); void *p = OSUtils::allocVirtualMemory(bytesToAllocate, &allocatedSize, OSUtils::kVMWritable | OSUtils::kVMExecutable);
if (!p) if (!p)
return nullptr; return nullptr;
JitBlocks.Push((uint8_t*)p); JitBlocks.Push((uint8_t*)p);