tag | 4f7d2cc5f750be49382d8c2a4b57cb72240f3460 | |
---|---|---|
tagger | The Android Open Source Project <initial-contribution@android.com> | Wed Feb 01 16:51:59 2023 -0800 |
object | ecd38b841a851e83621d332113ba467ae0564291 |
Platform Tools Release 33.0.4 (9550387)
commit | ecd38b841a851e83621d332113ba467ae0564291 | [log] [tgz] |
---|---|---|
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Wed Feb 01 10:59:26 2023 +0000 |
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Wed Feb 01 10:59:26 2023 +0000 |
tree | 84fe148a7bdc5e747fcf592db48e2793cceccb7c | |
parent | e03727f12a1339088d6a9aac9091a7cc4f02e7d2 [diff] | |
parent | 2a7bbc0cc37cf06ef98e7b46f1087e0dafe8a15f [diff] |
Snap for 9550355 from 2a7bbc0cc37cf06ef98e7b46f1087e0dafe8a15f to sdk-release Change-Id: I6b15eafc4b4208fb760333afe55a4789f8086ec6
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.