Skip to main content

decommit

Function decommit 

Source
pub unsafe fn decommit(base: *mut u8, start: usize, end: usize)
Expand description

Decommit pages [base + start, base + end): return their physical backing to the OS while keeping the address-space reservation alive. Re-access after decommit produces fresh zero-filled pages (after recommit on Windows; implicitly on Unix).

start and end must be multiples of PAGE and within the span. A no-op if the range is empty.

§Safety

base must be the as_ptr of a live reservation, and [base+start, base+end) must contain no data the caller still needs — its contents are discarded.