commit | 2d7f60bfe834146b6e98001d2a3f0ac7ccb9e5e0 | [log] [tgz] |
---|---|---|
author | Sam Saccone <samccone@google.com> | Tue Jul 18 17:51:14 2023 +0000 |
committer | Sam Saccone <samccone@google.com> | Tue Jul 18 17:51:14 2023 +0000 |
tree | ef63e5c08cc4d140d31894bfcf3863a2a5f03f5d | |
parent | 2078c1461353f9e29d33a761aeec9289c41d6f36 [diff] |
Move OWNER reference master=>main. BUG=b/291759353 Change-Id: I4b355881cee3cc9bb0ca71a8f267f09629e9e4d7
An (almost) drop-in replacement for phil-opp/linked-list-allocator. But it uses buddy system instead.
To use buddy_system_allocator for global allocator:
use buddy_system_allocator::LockedHeap; #[global_allocator] static HEAP_ALLOCATOR: LockedHeap = LockedHeap::<32>::empty();
To init the allocator:
unsafe { HEAP_ALLOCATOR.lock().init(heap_start, heap_size); // or HEAP_ALLOCATOR.lock().add_to_heap(heap_start, heap_end); }
You can also use FrameAllocator
and LockedHeapWithRescue
, see their documentation for usage.
use_spin
(default): Provide a LockedHeap
type that implements the GlobalAlloc
trait by using a spinlock.const_fn
(nightly only): Provide const fn version of LockedHeapWithRescue::new
.Some code comes from phil-opp's linked-list-allocator.
Licensed under MIT License. Thanks phill-opp's linked-list-allocator for inspirations and interface.