| ... | @@ -135,10 +135,9 @@ var general_purpose_allocator = std.heap.GeneralPurposeAllocator(.{ | ... | @@ -135,10 +135,9 @@ var general_purpose_allocator = std.heap.GeneralPurposeAllocator(.{ |
| 135 | pub fn main() anyerror!void { | 135 | pub fn main() anyerror!void { |
| 136 | crash_report.initialize(); | 136 | crash_report.initialize(); |
| 137 | | 137 | |
| 138 | var gpa_need_deinit = false; | 138 | const use_gpa = build_options.force_gpa or !builtin.link_libc; |
| 139 | const gpa = gpa: { | 139 | const gpa = gpa: { |
| 140 | if (build_options.force_gpa or !builtin.link_libc) { | 140 | if (use_gpa) { |
| 141 | gpa_need_deinit = true; | | |
| 142 | break :gpa general_purpose_allocator.allocator(); | 141 | break :gpa general_purpose_allocator.allocator(); |
| 143 | } | 142 | } |
| 144 | // We would prefer to use raw libc allocator here, but cannot | 143 | // We would prefer to use raw libc allocator here, but cannot |
| ... | @@ -148,7 +147,7 @@ pub fn main() anyerror!void { | ... | @@ -148,7 +147,7 @@ pub fn main() anyerror!void { |
| 148 | } | 147 | } |
| 149 | break :gpa std.heap.raw_c_allocator; | 148 | break :gpa std.heap.raw_c_allocator; |
| 150 | }; | 149 | }; |
| 151 | defer if (gpa_need_deinit) { | 150 | defer if (use_gpa) { |
| 152 | _ = general_purpose_allocator.deinit(); | 151 | _ = general_purpose_allocator.deinit(); |
| 153 | }; | 152 | }; |
| 154 | var arena_instance = std.heap.ArenaAllocator.init(gpa); | 153 | var arena_instance = std.heap.ArenaAllocator.init(gpa); |