Function region::lock [] [src]

pub fn lock(address: *const u8, size: usize) -> Result<(), Error>

Locks memory regions to RAM.

The memory pages within the address range is guaranteed to stay in RAM except for cases such as hibernation and memory starvation.

  • The address is rounded down to the closest page boundary.
  • The size is rounded up to the closest page boundary, relative to the address.

Examples

let data = [0; 100];
region::lock(data.as_ptr(), data.len()).unwrap();
region::unlock(data.as_ptr(), data.len()).unwrap();