Trait madvise::AdviseMemory [] [src]

pub trait AdviseMemory {
    fn advise_memory_access(&self, advice: AccessPattern) -> Result<()>;

Advise the operating system on the access pattern of this data. On unix-like systems this can be used to allow the operating system to page memory in and out more efficiently. This is used extensively by allocators, and will only improve performance in real programs in rare circumstances.

On Windows and other non-unix systems this is compiled into a no-op. As far as I can tell Windows has no equivalent API.


use madvise::{AccessPattern, AdviseMemory};
let mut my_vec = vec![0; 1024];
my_vec.advise_memory_access(AccessPattern::Sequential).expect("Advisory failed");
for i in &mut my_vec {
    *i += 1;

Required Methods