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 92a4fe1 commit 4512c11Copy full SHA for 4512c11
src/lib.rs
@@ -61,10 +61,14 @@ impl Heap {
61
/// anything else. This function is unsafe because it can cause undefined behavior if the
62
/// given address is invalid.
63
pub unsafe fn new(heap_bottom: usize, heap_size: usize) -> Heap {
64
- Heap {
65
- bottom: heap_bottom,
66
- size: heap_size,
67
- holes: HoleList::new(heap_bottom, heap_size),
+ if heap_size < HoleList::min_size() {
+ Self::empty()
+ } else {
+ Heap {
68
+ bottom: heap_bottom,
69
+ size: heap_size,
70
+ holes: HoleList::new(heap_bottom, heap_size),
71
+ }
72
}
73
74
0 commit comments