GPA: Add more tracking in Debug

Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
AnErrupTion 2026-07-28 01:38:48 +02:00
parent 7c2ae2738c
commit b6fba46b08
No known key found for this signature in database
1 changed files with 5 additions and 2 deletions

View File

@ -149,8 +149,11 @@ pub fn main(init: std.process.Init) !void {
}
}
var gpa = std.heap.DebugAllocator(.{}).init;
defer _ = gpa.deinit();
var gpa: std.heap.DebugAllocator(.{
.never_unmap = builtin.mode == .Debug,
.retain_metadata = builtin.mode == .Debug,
}) = .init;
defer if (gpa.deinit() == .leak) std.log.err("attention please, memory has been leaked!", .{});
state.allocator = gpa.allocator();