We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 49d98d1 commit 099dbdcCopy full SHA for 099dbdc
README.md
@@ -4,5 +4,29 @@
4
5
[Documentation](http://phil-opp.github.io/linked-list-allocator/linked_list_allocator/index.html)
6
7
+## Usage
8
+
9
+Create a static allocator in your root module:
10
11
+```rust
12
+use linked_list_allocator::LockedHeap;
13
14
+#[global_allocator]
15
+static ALLOCATOR: LockedHeap = LockedHeap::empty();
16
+```
17
18
+Before using this allocator, you need to init it:
19
20
21
+pub fn init_heap() {
22
+ let heap_start = …;
23
+ let heap_end = …;
24
+ let heap_size = heap_end - heap_start;
25
+ unsafe {
26
+ ALLOCATOR.lock().init(heap_start, heap_size);
27
+ }
28
+}
29
30
31
## License
32
This crate is dual-licensed under MIT or the Apache License (Version 2.0). See LICENSE-APACHE and LICENSE-MIT for details.
0 commit comments