Repository navigation
Do not use /dev/zero to mmap anonymous memory - #48140
Conversation
|
I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label. |
There was a problem hiding this comment.
This looks like a typo that somehow makes no difference. The Qcall returns void -
runtime/src/coreclr/vm/assemblynative.cpp
Line 297 in 69e114c
There was a problem hiding this comment.
that somehow makes no difference
Interesting. Does it just end up returning some garbage register value or something?
There was a problem hiding this comment.
Most likely it was returning in a register that callers immediately used to store something else. No callers used the returned value.
The original idea was that the mismatch in the returns was the reason for the "leak". Turns out it was a bit deeper than that, and fixing the return type did not change anything.
There was a problem hiding this comment.
The interop method would return whatever was in RAX / EAX / X0 / R0 at that point.
|
Hello @VSadov! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
|
Thanks!! |
Long time ago
/dev/zerowas commonly used to map anonymous memory becauseMAP_ANON/MAP_ANONYMOUSwas not universally supported.Nowdays there is no reason for that and using
MAP_ANON/MAP_ANONYMOUSsaves one fd per mapping.The limit for fd count could be modest (1024 is a typical default) and these can add up quickly when loading assemblies from streams.
Even when collectible context is used the count could be abnormally high since complete unloading requires 2 full GC cycles and can be delayed for other reasons.
Fixes:#47859