Use std::alloc::alloc

This commit is contained in:
Yota Toyama
2019-04-30 15:28:16 +00:00
parent ac9bb2ec16
commit 50097eb073
4 changed files with 8 additions and 8 deletions

View File

@@ -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()) };
}
});

View File

@@ -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() }

View File

@@ -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()) };
}
}

View File

@@ -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()) };
}
});