Skip to main content

lock_mem

Function lock_mem 

Source
pub fn lock_mem<T: Sized>(ptr: *const T, size: usize) -> bool
Expand description

Try to lock the memory segment into memory, preventing it from being moved to the disk. All calls to this function must be followed by a call to unlock_mem().

Use this method with extreme care because it interferes with tne OS ability to manage virtual memory.

Arguments:

  • ptr: The pointer to the memory segment;
  • size: The size of the ptr in units;

Retunrs true on success or false otherwise.