authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-12-16 15:49:08-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-01-01 17:51:20-07:00
log9b98d33d0b76a8c8b23958c89ab7e952893697be
tree7d9f8349366d92025c71cf7e328fe25cd25fa719
parentf2564318385ea90b08af044ae32ddef26e6346bd

Compilation: don't store arena until it's done being used


1 files changed, 2 insertions(+), 1 deletions(-)

src/Compilation.zig+2-1
...@@ -1443,7 +1443,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {...@@ -1443,7 +1443,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
14431443
1444 comp.* = .{1444 comp.* = .{
1445 .gpa = gpa,1445 .gpa = gpa,
1446 .arena = arena_allocator,1446 .arena = undefined, // populated after we are finished with `arena`
1447 .module = opt_zcu,1447 .module = opt_zcu,
1448 .cache_use = undefined, // populated below1448 .cache_use = undefined, // populated below
1449 .bin_file = null, // populated below1449 .bin_file = null, // populated below
...@@ -1667,6 +1667,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {...@@ -1667,6 +1667,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
1667 },1667 },
1668 }1668 }
16691669
1670 comp.arena = arena_allocator;
1670 break :comp comp;1671 break :comp comp;
1671 };1672 };
1672 errdefer comp.destroy();1673 errdefer comp.destroy();