Skip to main content

alloc_zeroed

Function alloc_zeroed 

Source
pub fn alloc_zeroed<T: Zeroable>(len: usize) -> Result<Vec<T>>
Expand description

Allocate a zero-initialised vector without aborting on allocation failure.

Large zeroed allocations are served by the OS as lazily-mapped zero pages (calloc semantics), avoiding an explicit memset of 100+ MB buffers that the decoder is about to overwrite anyway.