From 4700fa924ab82ca2e41daa627a59f691d8177d5b Mon Sep 17 00:00:00 2001 From: Martin Ashby Date: Sun, 3 Dec 2023 22:09:16 +0000 Subject: Fix the annoying freeze on .free It was caused by duplicating GeneralPurposeAllocator, by using it as a struct value. It has a mutex in it, so don't do that. --- day1.zig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'day1.zig') diff --git a/day1.zig b/day1.zig index 5258b4e..5143fdc 100644 --- a/day1.zig +++ b/day1.zig @@ -49,7 +49,9 @@ const w2d = std.comptime_string_map.ComptimeStringMap(u8, .{ }); pub fn main() !void { - var s = try Setup.get(); + var gpa = std.heap.GeneralPurposeAllocator(.{}){}; + defer _ = gpa.deinit(); + var s = try Setup.get(gpa.allocator()); defer s.deinit(); var l = std.mem.splitScalar(u8, s.input, '\n'); var t: u64 = 0; -- cgit v1.2.3-ZIG