Skip to main content

discard

Function discard 

Source
pub unsafe fn discard(ptr: NonNull<u8>, len: usize) -> bool
Expand description

Return the physical pages backing len bytes at ptr to the OS while keeping the range mapped and addressable.

The range must be page-aligned and a whole number of pages. Contents are discarded: a later read sees zeroes, which is why only spans with no live slots are ever passed here.

ยงSafety

ptr/len must lie inside a live mapping from map_aligned, and no live data may remain in the range.