hugepage-rs wrapped allocator for linux hugepage.
Hugepage allocator provides two interfaces for operation, hugepagers::alloc and hugepagers::dealloc, allocate and free hugepage memory.
The hugepagers::alloc() function allocates size bytes and returns a pointer to the allocated memory. *The memory is not initialized*. returns std::ptr::nullmut() if allocation fails, otherwise returns a pointer.
```rust use hugepage_rs;
use std::alloc::Layout; use std::{mem, ptr};
fn main() {
let layout = Layout::array::
let src = String::from("hello");
let len = src.len();
unsafe {
ptr::copy_nonoverlapping(src.as_ptr(), dst, len);
let s = String::from_raw_parts(dst, len, len);
assert_eq!(s, src);
mem::forget(s);
}
hugepage_rs::dealloc(dst, layout);
} ```
Simple Box
``` use hugepage_rs;
fn main() { let mut v = hugepagers::Box::new(5); *v += 42; asserteq!(*v, 47); } ```
Huge pages part 1 (Introduction)
Huge pages part 3: Administration
Huge pages part 4: benchmarking with huge pages
Huge pages part 5: A deeper look at TLBs and costs