authorgravatar for johnnymarler@gmail.comJonathan Marler <johnnymarler@gmail.com> 2020-06-28 23:44:48-06:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-06-29 05:12:30-04:00
log67e97a1f0fe661b05234e24a58be15d9b48588f2
tree298603cf42a4bdd221466d9ea22f44cfd800d070
parent35e8876c23e53c11115c78ff3984effa965a8cca

ArenaAllocator: use full capacity


1 files changed, 2 insertions(+), 3 deletions(-)

lib/std/heap/arena_allocator.zig+2-3
......@@ -49,9 +49,8 @@ pub const ArenaAllocator = struct {
4949 const actual_min_size = minimum_size + (@sizeOf(BufNode) + 16);
5050 const big_enough_len = prev_len + actual_min_size;
5151 const len = big_enough_len + big_enough_len / 2;
52 const buf = try self.child_allocator.alignedAlloc(u8, @alignOf(BufNode), len);
53 const buf_node_slice = mem.bytesAsSlice(BufNode, buf[0..@sizeOf(BufNode)]);
54 const buf_node = &buf_node_slice[0];
52 const buf = try self.child_allocator.callAllocFn(len, @alignOf(BufNode), 1);
53 const buf_node = @ptrCast(*BufNode, @alignCast(@alignOf(BufNode), buf.ptr));
5554 buf_node.* = BufNode{
5655 .data = buf,
5756 .next = null,