free

Function free 

Source
pub unsafe fn free(ptr: *mut u8) -> Result<(), DeallocationError>
Expand description

This method is the counterpart to crate::alloc.

Every pointer allocated by crate::alloc must eventually be freed using this function.

§Errors

An error is returned if a safety check fails.

§Safety

Only pointers allocated by crate::alloc can be freed using this method. Using this method on any other pointer causes undefined behaviour. This method provides safety checks, however, these are provided on a best effort basis and are an indication undefined behaviour has already occured. Unless ptr is misaligned or null, this function will dereference it.