Skip to main content

alloc_page_aligned_zeroed

Function alloc_page_aligned_zeroed 

Source
pub fn alloc_page_aligned_zeroed(len: usize) -> Vec<u8> 
Expand description

Allocate a zero-filled Vec<u8> of len bytes (rounded up to the next page boundary) with PAGE_SIZE-aligned backing storage.

The resulting Vec has len == capacity == padded_len; all bytes are zero. Page alignment of the underlying allocation is what lets the kernel later map the buffer directly into a ring-3 PT.

Panics if the allocator returns null (out-of-memory) or if constructing the Layout overflows.