diff --git a/src/coreclr/pal/src/map/virtual.cpp b/src/coreclr/pal/src/map/virtual.cpp index ea7e7e52c96877..043502e916acd1 100644 --- a/src/coreclr/pal/src/map/virtual.cpp +++ b/src/coreclr/pal/src/map/virtual.cpp @@ -716,7 +716,7 @@ VIRTUALCommitMemory( nProtect = W32toUnixAccessControl(flProtect); pRetVal = (void *) StartBoundary; - + #ifndef TARGET_WASM // Commit the pages if (mprotect((void *) StartBoundary, MemSize, nProtect) != 0) @@ -1581,8 +1581,13 @@ void ExecutableMemoryAllocator::TryReserveInitialMemory() int32_t sizeOfAllocation = MaxExecutableMemorySizeNearCoreClr; int32_t initialReserveLimit = -1; +#ifdef RLIMIT_AS + int addressSpace = RLIMIT_AS; +#else + int addressSpace = RLIMIT_DATA; +#endif rlimit addressSpaceLimit; - if ((getrlimit(RLIMIT_AS, &addressSpaceLimit) == 0) && (addressSpaceLimit.rlim_cur != RLIM_INFINITY)) + if ((getrlimit(addressSpace, &addressSpaceLimit) == 0) && (addressSpaceLimit.rlim_cur != RLIM_INFINITY)) { // By default reserve max 20% of the available virtual address space rlim_t initialExecMemoryPerc = 20;