From 8be3275352cad9cad24665115930d18c1cd920fa Mon Sep 17 00:00:00 2001 From: Martin Ashby Date: Thu, 19 Oct 2023 22:06:57 +0100 Subject: Fix build.zig.zon Fix test --- src/max_allocator.zig | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/max_allocator.zig') diff --git a/src/max_allocator.zig b/src/max_allocator.zig index 00b8630..8b1f7be 100644 --- a/src/max_allocator.zig +++ b/src/max_allocator.zig @@ -22,7 +22,6 @@ pub const MaxAllocator = struct { var res = self.backing_allocator.rawAlloc(len, ptr_align, ret_addr); if (res != null) { self.currently_allocated += len; - std.log.warn("+{}", .{len}); self.max_allocated = @max(self.currently_allocated, self.max_allocated); } return res; @@ -33,9 +32,7 @@ pub const MaxAllocator = struct { const res = self.backing_allocator.rawResize(buf, buf_align, new_len, ret_addr); if (res) { self.currently_allocated -= buf.len; - std.log.warn("-{}", .{buf.len}); self.currently_allocated += new_len; - std.log.warn("+{}", .{new_len}); self.max_allocated = @max(self.currently_allocated, self.max_allocated); } return res; @@ -45,7 +42,6 @@ pub const MaxAllocator = struct { var self: *@This() = @alignCast(@ptrCast(ctx)); self.backing_allocator.rawFree(buf, buf_align, ret_addr); self.currently_allocated -= buf.len; - std.log.warn("-{}", .{buf.len}); } }; @@ -71,6 +67,7 @@ test { try std.testing.expectEqual(@as(usize, 60), ma.currently_allocated); try std.testing.expect(a.resize(z, 1024)); + z.len = 1024; try std.testing.expectEqual(@as(usize, 1034), ma.max_allocated); try std.testing.expectEqual(@as(usize, 1034), ma.currently_allocated); @@ -78,6 +75,5 @@ test { a.free(z); try std.testing.expectEqual(@as(usize, 1034), ma.max_allocated); - try std.testing.expectEqual(@as(usize, 0), ma.currently_allocated); // works on aarch64, not on x86_64 :thinking-face: - try std.testing.expectEqual(@as(usize, 0), fba.end_index); + try std.testing.expectEqual(@as(usize, 0), ma.currently_allocated); } -- cgit v1.2.3-ZIG