[PATCH] Fix off-by-one error in `DroplessArena::alloc_raw`.
authorNicholas Nethercote <nnethercote@mozilla.com>
Thu, 21 May 2020 00:36:32 +0000 (10:36 +1000)
committerXimin Luo <infinity0@debian.org>
Thu, 6 Aug 2020 20:11:39 +0000 (21:11 +0100)
This causes unnecessary calls to `grow` when the allocation would fit
exactly in the remaining space.

Gbp-Pq: Name u-5ceff6b96af9a21e044545b9e064433feccaf659.patch

src/libarena/lib.rs

index bbe80c26dcbf98d9c2612e15eb6b4670fdd4c274..725850036bbbf02aadc0b5c47dff798d09c32511 100644 (file)
@@ -386,7 +386,7 @@ impl DroplessArena {
             self.align(align);
 
             let future_end = intrinsics::arith_offset(self.ptr.get(), bytes as isize);
-            if (future_end as *mut u8) >= self.end.get() {
+            if (future_end as *mut u8) > self.end.get() {
                 self.grow(bytes);
             }