pub fn reserve_aligned_lazy(
size: usize,
align: usize,
initial_commit: usize,
) -> Option<LazyReservation>lazy-commit only.Expand description
Reserve size bytes of anonymous virtual memory whose base is aligned to
align, committing ONLY the first initial_commit bytes — the rest is
reserved but NOT committed (on Windows; on Unix/miri ALL pages are committed,
matching the eager path).
See reserve_aligned for the base/align contract. initial_commit must
be a non-zero multiple of the runtime page_size() (not the compile-time
PAGE) and <= size; size must also be a multiple of page_size().
Violations return None. This stricter contract exists because on Windows,
VirtualAlloc(MEM_COMMIT) operates on whole runtime pages and
commit_range accepts only offsets that are multiples of page_size(); a
size not aligned to page_size() would create an unwritable tail that
cannot be committed via the public API.
The returned LazyReservation frees the ENTIRE VA
reservation on drop regardless of how much was committed. (Until task #1118
this sentence named Reservation — the wrong type. This function has
returned Option<LazyReservation> since task #1051 introduced the
watermark-owning wrapper; the reviewer who found it noted that a
publication-readiness wave spent three commits resealing exactly this type
without reading its own entry point’s rustdoc.) For the failure cause use
try_reserve_aligned_lazy.