Skip to content

Commit 93cf774

Browse files
doc: Improve documentation for buddy system heap order explanation
- Clarify that the real order of the buddy system is `ORDER - 1`. Signed-off-by: bigsaltyfishes <bigsaltyfishes@gmail.com>
1 parent 1bf005a commit 93cf774

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ pub use frame::*;
3939
/// ```
4040
/// use buddy_system_allocator::*;
4141
/// # use core::mem::size_of;
42-
/// let mut heap = Heap::<32>::empty();
42+
/// // The order of the buddy system is `ORDER - 1`.
43+
/// // For example, to create a heap with a maximum block size of 2^32 bytes,
44+
/// // you should define the heap with `ORDER = 33`.
45+
/// let mut heap = Heap::<33>::empty();
4346
/// # let space: [usize; 100] = [0; 100];
4447
/// # let begin: usize = space.as_ptr() as usize;
4548
/// # let end: usize = begin + 100 * size_of::<usize>();

0 commit comments

Comments
 (0)