mirror of
https://github.com/bdwgc/bdwgc-rust.git
synced 2026-05-31 19:08:55 -06:00
Use std::alloc::alloc
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
extern crate bdwgc_alloc;
|
||||
|
||||
use bdwgc_alloc::Allocator;
|
||||
use std::alloc::{GlobalAlloc, Layout};
|
||||
use std::alloc::Layout;
|
||||
|
||||
#[global_allocator]
|
||||
static GLOBAL_ALLOCATOR: Allocator = Allocator;
|
||||
@@ -14,7 +14,7 @@ fn main() {
|
||||
unsafe { Allocator::register_current_thread().unwrap() }
|
||||
|
||||
for _ in 0..100 {
|
||||
unsafe { GLOBAL_ALLOCATOR.alloc(Layout::from_size_align(2 ^ 8, 8).unwrap()) };
|
||||
unsafe { std::alloc::alloc(Layout::from_size_align(2 ^ 8, 8).unwrap()) };
|
||||
}
|
||||
|
||||
unsafe { Allocator::unregister_current_thread() }
|
||||
|
||||
Reference in New Issue
Block a user