From 50097eb073e395c31ec6230ff8ae2f2383a3f8a6 Mon Sep 17 00:00:00 2001 From: Yota Toyama Date: Tue, 30 Apr 2019 15:28:16 +0000 Subject: [PATCH] Use std::alloc::alloc --- examples/coroutines/src/main.rs | 4 ++-- examples/dynamic_threads/src/main.rs | 4 ++-- examples/free_by_gc/src/main.rs | 4 ++-- examples/static_threads/src/main.rs | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/coroutines/src/main.rs b/examples/coroutines/src/main.rs index 8ea6558..86f730d 100644 --- a/examples/coroutines/src/main.rs +++ b/examples/coroutines/src/main.rs @@ -3,7 +3,7 @@ extern crate coroutine; use bdwgc_alloc::Allocator; use coroutine::asymmetric::Coroutine; -use std::alloc::{GlobalAlloc, Layout}; +use std::alloc::Layout; #[global_allocator] static GLOBAL_ALLOCATOR: Allocator = Allocator; @@ -18,7 +18,7 @@ fn main() { Allocator::enable_gc(); loop { - unsafe { GLOBAL_ALLOCATOR.alloc(Layout::from_size_align(2 ^ 8, 8).unwrap()) }; + unsafe { std::alloc::alloc(Layout::from_size_align(2 ^ 8, 8).unwrap()) }; } }); diff --git a/examples/dynamic_threads/src/main.rs b/examples/dynamic_threads/src/main.rs index 4efc531..bd3365f 100644 --- a/examples/dynamic_threads/src/main.rs +++ b/examples/dynamic_threads/src/main.rs @@ -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() } diff --git a/examples/free_by_gc/src/main.rs b/examples/free_by_gc/src/main.rs index 5b2aaf6..94b26ef 100644 --- a/examples/free_by_gc/src/main.rs +++ b/examples/free_by_gc/src/main.rs @@ -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; @@ -10,6 +10,6 @@ fn main() { unsafe { Allocator::initialize() } loop { - unsafe { GLOBAL_ALLOCATOR.alloc(Layout::from_size_align(2 ^ 8, 8).unwrap()) }; + unsafe { std::alloc::alloc(Layout::from_size_align(2 ^ 8, 8).unwrap()) }; } } diff --git a/examples/static_threads/src/main.rs b/examples/static_threads/src/main.rs index 4dc6d99..dda7581 100644 --- a/examples/static_threads/src/main.rs +++ b/examples/static_threads/src/main.rs @@ -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; @@ -13,7 +13,7 @@ fn main() { unsafe { Allocator::register_current_thread().unwrap() } loop { - unsafe { GLOBAL_ALLOCATOR.alloc(Layout::from_size_align(2 ^ 8, 8).unwrap()) }; + unsafe { std::alloc::alloc(Layout::from_size_align(2 ^ 8, 8).unwrap()) }; } });