INNER CODE UNIT · Rust
allocated
spacejam/sled · src/alloc.rs:49
fn allocated() -> usize {
ALLOCATED.swap(0, Ordering::Relaxed)
}
fn freed() -> usize {
FREED.swap(0, Ordering::Relaxed)
}
fn resident() -> usize {
RESIDENT.load(Ordering::Relaxed)
}
#[derive(Default, Debug, Clone, Copy)]
struct CountingAllocator;
unsafe impl std::alloc::GlobalAlloc for CountingAllocator {
unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
let ret = System.alloc(layout);