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. --- day2.zig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'day2.zig') diff --git a/day2.zig b/day2.zig index 9ce71d9..c29bd0e 100644 --- a/day2.zig +++ b/day2.zig @@ -16,7 +16,9 @@ const Colour = enum { }; pub fn main() !void { - var setup = try Setup.get(); + var gpa = std.heap.GeneralPurposeAllocator(.{}){}; + defer _ = gpa.deinit(); + var setup = try Setup.get(gpa.allocator()); defer setup.deinit(); var sum: u32 = 0; var lines = std.mem.splitScalar(u8, setup.input, '\n'); -- cgit v1.2.3-ZIG