-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
System.OutOfMemoryException when allocating jump stub on macOS ARM64 #83818
Labels
Comments
ghost
added
the
in-pr
There is an active PR which will close this issue when it is merged
label
Mar 23, 2023
k15tfu
added a commit
to k15tfu/runtime
that referenced
this issue
Mar 24, 2023
…llocWithinRange() Fixes dotnet#83818
ghost
removed
in-pr
There is an active PR which will close this issue when it is merged
untriaged
New issue has not been triaged by the area owner
labels
Mar 24, 2023
github-actions bot
pushed a commit
that referenced
this issue
Mar 27, 2023
…llocWithinRange() Fixes #83818
ghost
added
the
in-pr
There is an active PR which will close this issue when it is merged
label
Mar 28, 2023
k15tfu
added a commit
to k15tfu/runtime
that referenced
this issue
Mar 28, 2023
jkotas
pushed a commit
that referenced
this issue
Mar 28, 2023
ghost
removed
the
in-pr
There is an active PR which will close this issue when it is merged
label
Mar 28, 2023
ghost
locked as resolved and limited conversation to collaborators
Apr 28, 2023
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi!
Sometimes I get a
System.OutOfMemoryException
exception in .NET 7 app on macOS ARM64 in arbitrary places like:Digging into this, it turned out that the exception is thrown from
HostCodeHeap::InitializeHeapList()
:runtime/src/coreclr/vm/dynamicmethod.cpp
Lines 442 to 449 in d037e07
because
ExecutableAllocator::Commit()
failed to commit executable memory:runtime/src/coreclr/vm/dynamicmethod.cpp
Lines 758 to 762 in d037e07
On macOS ARM64
ExecutableAllocator::IsDoubleMappingEnabled()
is disabled, thus it internally callsVirtualAlloc(..., MEM_COMMIT, PAGE_EXECUTE_READWRITE)
for the pre-reserved memoryHostCodeHeap::m_pLastAvailableCommittedAddr
, but thenmprotect(..., PROT_EXEC | PROT_READ | PROT_WRITE)
fails with errnoEACCES
(akaPermission denied
):runtime/src/coreclr/pal/src/map/virtual.cpp
Lines 1202 to 1216 in d037e07
because initially this memory region was reserved w/o
MEM_RESERVE_EXECUTABLE
flag (which is used forMAP_JIT
):runtime/src/coreclr/utilcode/util.cpp
Lines 448 to 460 in d037e07
despite the fact that
ExecutableAllocator::ReserveWithinRange()
actually requests it:runtime/src/coreclr/utilcode/executableallocator.cpp
Lines 595 to 605 in d037e07
Linked issues: #50391, #54954.
The text was updated successfully, but these errors were encountered: