17 lines
336 B
Rust
17 lines
336 B
Rust
use alloc::alloc::{GlobalAlloc, Layout};
|
|
|
|
struct MyAllocator;
|
|
|
|
unsafe impl GlobalAlloc for MyAllocator {
|
|
unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
|
|
panic!();
|
|
}
|
|
|
|
unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) {
|
|
panic!();
|
|
}
|
|
}
|
|
|
|
#[global_allocator]
|
|
static GLOBAL: MyAllocator = MyAllocator;
|