blob: a600cfa2220dd64cf67dc2cc1072551faef74533 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
  | 
use crate::alloc::{GlobalAlloc, Layout, System};
use crate::sys::pal::abi;
#[stable(feature = "alloc_system_type", since = "1.28.0")]
unsafe impl GlobalAlloc for System {
    #[inline]
    unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
        unsafe { abi::sys_alloc_aligned(layout.size(), layout.align()) }
    }
    #[inline]
    unsafe fn dealloc(&self, _ptr: *mut u8, _layout: Layout) {
        // this allocator never deallocates memory
    }
}
 
  |