| author | |
| committer | |
| log | 76498686639d01050eb917b016a61c58503510e5 |
| tree | 7c84cde05a222ac8cd3e20700a0a11d02f70189e |
| parent | 2ba8c94df6b9e60d73c35bf3d1f80f143fc80cab |
Shrinking allocations should always succeed with these allocators, even
if the allocation in question is the most recent one and `resize` didn't
manage to decrement the end index of its buffer successfully.2 files changed, 4 insertions(+), 2 deletions(-)
lib/std/heap/ArenaAllocator.zig+2-1| ... | ... | @@ -572,7 +572,8 @@ fn resize(ctx: *anyopaque, memory: []u8, alignment: Alignment, new_len: usize, r |
| 572 | 572 | new_end_index, |
| 573 | 573 | .monotonic, |
| 574 | 574 | .monotonic, |
| 575 | ); | |
| 575 | ) or | |
| 576 | new_len <= memory.len; // Shrinking allocations should always succeed. | |
| 576 | 577 | } |
| 577 | 578 | |
| 578 | 579 | fn remap(ctx: *anyopaque, memory: []u8, alignment: Alignment, new_len: usize, ret_addr: usize) ?[*]u8 { |
lib/std/heap/FixedBufferAllocator.zig+2-1| ... | ... | @@ -172,7 +172,8 @@ fn threadSafeResize(ctx: *anyopaque, memory: []u8, alignment: mem.Alignment, new |
| 172 | 172 | new_end_index, |
| 173 | 173 | .monotonic, |
| 174 | 174 | .monotonic, |
| 175 | ); | |
| 175 | ) or | |
| 176 | new_len <= memory.len; // Shrinking allocations should always succeed. | |
| 176 | 177 | } |
| 177 | 178 | |
| 178 | 179 | fn threadSafeRemap(ctx: *anyopaque, memory: []u8, alignment: mem.Alignment, new_len: usize, ret_addr: usize) ?[*]u8 { |