use std::alloc::{GlobalAlloc, Layout};
use libmimalloc_sys_ms::{mi_free, mi_malloc_aligned, mi_realloc_aligned, mi_zalloc_aligned};
pub struct Vanilla;
unsafe impl GlobalAlloc for Vanilla {
unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
unsafe { mi_malloc_aligned(layout.size(), layout.align()) as *mut u8 }
}
unsafe fn dealloc(&self, ptr: *mut u8, _layout: Layout) {
unsafe { mi_free(ptr as *mut _) }
}
unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8 {
unsafe { mi_zalloc_aligned(layout.size(), layout.align()) as *mut u8 }
}
unsafe fn realloc(&self, ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8 {
unsafe { mi_realloc_aligned(ptr as *mut _, new_size, layout.align()) as *mut u8 }
}
}