Add mremap
to std.posix
, and use it in std.heap.PageAllocator
when available.
#22199
+165
−25
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Additionally moves
std.heap.next_mmap_addr_hint
intostd.heap.PageAllocator
, the only place in the stdlib where it is used.As it stands, this PR is fully functional, but I am setting this as a draft, as between its limited support and sometimes variable length arguments, there is some ambiguity around the proper way to expose
mremap
instd.posix
. My hope is to get the opinions of more prominent contributors and potentially core members.I haven't done any serious or proper benchmarks, but on targets which support
mremap
, just from watching the output of naive test programs, this seems to have made a substantial improvement in the performance of resize operations instd.heap.page_allocator
.