Skip to content

Commit 8230769

Browse files
committed
Don't treat small heaps as empty to allow subsequent extension
It is important to keep the original start pointer in case the user wants to extend it.
1 parent c3558d2 commit 8230769

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/lib.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,9 @@ impl Heap {
115115
///
116116
/// The provided memory range must be valid for the `'static` lifetime.
117117
pub unsafe fn new(heap_bottom: *mut u8, heap_size: usize) -> Heap {
118-
if heap_size < HoleList::min_size() {
119-
Self::empty()
120-
} else {
121-
Heap {
122-
used: 0,
123-
holes: HoleList::new(heap_bottom, heap_size),
124-
}
118+
Heap {
119+
used: 0,
120+
holes: HoleList::new(heap_bottom, heap_size),
125121
}
126122
}
127123

0 commit comments

Comments
 (0)