diff --git a/Cargo.lock b/Cargo.lock index 74ed0a5..6e94f21 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,4 +1,4 @@ [[package]] name = "tcmalloc" -version = "0.1.2" +version = "0.1.3" diff --git a/src/lib.rs b/src/lib.rs index 8e2c022..9fb50d7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,6 @@ #![feature(allocator_api)] -use std::alloc::{GlobalAlloc, Layout, Opaque}; +use std::alloc::{GlobalAlloc, Layout}; use std::os::raw::c_void; @@ -15,11 +15,11 @@ extern "C" { pub struct TCMalloc; unsafe impl GlobalAlloc for TCMalloc { - unsafe fn alloc(&self, layout: Layout) -> *mut Opaque { - tc_memalign(layout.align(), layout.size()) as *mut Opaque + unsafe fn alloc(&self, layout: Layout) -> *mut u8 { + tc_memalign(layout.align(), layout.size()) as *mut u8 } - unsafe fn dealloc(&self, ptr: *mut Opaque, _layout: Layout) { + unsafe fn dealloc(&self, ptr: *mut u8, _layout: Layout) { tc_free(ptr as *mut c_void); // tc_free_sized(ptr as *mut c_void, layout.size()); }