nolock 0.4.1

A collection of Lock-Free Datastructures
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use std::alloc::{GlobalAlloc, Layout};

use nolock::allocator::lrmalloc;

#[test]
fn alloc_dealloc() {
    let allocator = lrmalloc::Allocator::new();

    let layout = Layout::new::<usize>();

    for _ in 0..30 {
        let ptr = unsafe { allocator.alloc(layout) };
        unsafe { allocator.dealloc(ptr, layout) };
    }

    let ptr = unsafe { allocator.alloc(layout) };
    unsafe { allocator.dealloc(ptr, layout) };
}