Add an example of free by borrow check

This commit is contained in:
Yota Toyama
2019-04-15 15:51:15 +00:00
parent dc860f963c
commit 655f7b04f2
3 changed files with 48 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
extern crate bdwgc_alloc;
use bdwgc_alloc::Allocator;
#[global_allocator]
static GLOBAL_ALLOCATOR: Allocator = Allocator;
fn main() {
unsafe { Allocator::initialize() }
let mut _n: Box<[u8; 2 ^ 8]> = Box::new([0; 2 ^ 8]);
loop {
_n = Box::new([0; 2 ^ 8]);
}
}