summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/max_allocator.zig8
1 files changed, 2 insertions, 6 deletions
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);
}