Skip to main content

reserve_aligned

Function reserve_aligned 

Source
pub fn reserve_aligned(size: usize, align: usize) -> Option<Reservation>
Expand description

Reserve size bytes of anonymous virtual memory whose base is aligned to align, via the over-reserve + trim technique.

  • align must be a power of two >= PAGE.
  • size must be a non-zero multiple of PAGE.

Returns None on a contract violation or if the OS refuses the reservation (OOM) — never panics, so it is safe to call from inside a GlobalAlloc implementation.