26 lines
611 B
Rust
26 lines
611 B
Rust
use alloc::alloc::{GlobalAlloc, Layout};
|
|
use core::ptr::null_mut;
|
|
|
|
// struct Dummy :::
|
|
pub struct Dummy;
|
|
|
|
unsafe impl GlobalAlloc for Dummy {
|
|
// fn alloc :::
|
|
// &self :param:
|
|
// _layout: Layout :param:
|
|
unsafe fn alloc(&self, _layout: Layout) -> *mut u8 {
|
|
null_mut()
|
|
}
|
|
|
|
// fn dealloc :::
|
|
// &self :param:
|
|
// _ptr: *mut u8 :param:
|
|
// _layout: Layout :param:
|
|
unsafe fn dealloc(&self, _ptr: *mut u8, _layout: Layout) {
|
|
panic!("allocator::dealloc() should never be called")
|
|
}
|
|
}
|
|
|
|
// ALLOCATOR: Dummy :::
|
|
#[global_allocator]
|
|
static ALLOCATOR: Dummy = Dummy;
|