From 9b98d33d0b76a8c8b23958c89ab7e952893697be Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sat, 16 Dec 2023 15:49:08 -0700 Subject: Compilation: don't store arena until it's done being used --- src/Compilation.zig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/Compilation.zig') diff --git a/src/Compilation.zig b/src/Compilation.zig index 7314da3960..d8d8bbc39d 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -1443,7 +1443,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { comp.* = .{ .gpa = gpa, - .arena = arena_allocator, + .arena = undefined, // populated after we are finished with `arena` .module = opt_zcu, .cache_use = undefined, // populated below .bin_file = null, // populated below @@ -1667,6 +1667,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { }, } + comp.arena = arena_allocator; break :comp comp; }; errdefer comp.destroy(); -- cgit v1.2.3