From de1be63b8243a5e7856c95f76b89484924a082c0 Mon Sep 17 00:00:00 2001 From: Andrew Walbran Date: Fri, 3 Mar 2023 18:01:31 +0000 Subject: [PATCH] Add more details about alloc. --- src/bare-metal/alloc.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/bare-metal/alloc.md b/src/bare-metal/alloc.md index ee54ea9e..63484b82 100644 --- a/src/bare-metal/alloc.md +++ b/src/bare-metal/alloc.md @@ -1,6 +1,7 @@ # `alloc` -To use `alloc` you must implement a global (heap) allocator. +To use `alloc` you must implement a +[global (heap) allocator](https://doc.rust-lang.org/stable/std/alloc/trait.GlobalAlloc.html). ```rust,editable,compile_fail {{#include alloc-example/src/main.rs:Alloc}} @@ -12,5 +13,7 @@ To use `alloc` you must implement a global (heap) allocator. 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. +* If any crate in your dependency tree depends on `alloc` then you must have exactly one global + allocator defined in your binary. Usually this is done in the top-level binary crate.