1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-04-15 21:28:43 +02:00
2023-03-20 14:26:57 +00:00

491 B

alloc

To use alloc you must implement a global (heap) allocator.

{{#include alloc-example/src/main.rs:Alloc}}
  • buddy_system_allocator is a third-party crate implementing a basic buddy system allocator. Other crates are available, or you can write your own or hook into your existing allocator.
  • The const parameter of LockedHeap is the max order of the allocator; i.e. in this case it can allocate regions of up to 2**32 bytes.