You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some applications may reserve large chunk of memory (e.g., 4GB) upfront but only uses a small portion of it. When allocating memory with no permission, we should only reserve memory without committing any pages on Windows platform. We then commit reserved pages when accessible permissions are later requested.
One limitation is that MemoryRegionPermissions::empty() cannot distinguish a reserve-only mapping from MEM_COMMIT | PAGE_NOACCESS. The latter currently remains reserved on the host. Supporting committed inaccessible pages requires representing commitment separately from permissions.
MAP_POPULATE | PROT_NONE can still call do_prefetch_on_range after reserve_and_maybe_commit leaves the range uncommitted. This occurs in the MEM_FREE path around lines 1772–1787 and the anonymous fallback around lines 1797–1808. PrefetchVirtualMemory requires a range accessible to the target process, and failure currently triggers an assertion. Please skip prefetching when initial_permissions.is_empty() .
The collision check around lines 1710–1726 only treats MEM_COMMIT regions as occupied. Now that a live PROT_NONE mapping can remain MEM_RESERVE , a subsequent allocation may treat its address as available. Vmem::insert_mapping protects the normal NoReplace path through its VMA map, but Hint and direct provider behavior can still incorrectly reuse the range. The provider needs a way to distinguish live reserve-only mappings from reusable reserved padding/decommitted regions and include live mappings in collision handling.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Some applications may reserve large chunk of memory (e.g., 4GB) upfront but only uses a small portion of it. When allocating memory with no permission, we should only reserve memory without committing any pages on Windows platform. We then commit reserved pages when accessible permissions are later requested.
One limitation is that
MemoryRegionPermissions::empty()cannot distinguish a reserve-only mapping fromMEM_COMMIT | PAGE_NOACCESS. The latter currently remains reserved on the host. Supporting committed inaccessible pages requires representing commitment separately from permissions.