| 130 | /// and all allocations made after it must already have been popped. |
| 131 | #[inline(always)] |
| 132 | pub unsafe fn pop(&mut self, base: *mut u8) { |
| 133 | debug_assert!(!base.is_null()); |
| 134 | if self.is_in_current_chunk(base) { |
| 135 | // Common case: base is within the current chunk. |
| 136 | self.top = base; |
| 137 | } else { |
| 138 | // base is in a previous chunk — free the current chunk. |
| 139 | unsafe { self.pop_slow(base) }; |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | /// Check if `ptr` falls within the current chunk's data area. |
| 144 | /// Both bounds are checked to handle non-monotonic allocation addresses |