From a34375814106dbc0e0181bca7cc4ffb1821cb51e Mon Sep 17 00:00:00 2001 From: Ryan Liptak Date: Mon, 1 Nov 2021 00:56:55 -0700 Subject: Update ensureTotalCapacity to ensureTotalCapacityPrecise where it makes sense These calls are all late-initialization of ArrayList's that were initialized outside the current scope. This allows us to still get the potential memory-saving benefits of the 'precision' of initCapacity. --- src/Module.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Module.zig') diff --git a/src/Module.zig b/src/Module.zig index 1f394a0833..c975fc1c36 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -4146,7 +4146,7 @@ pub fn analyzeFnBody(mod: *Module, decl: *Decl, func: *Fn, arena: *Allocator) Se // for the runtime ones. const fn_ty = decl.ty; const runtime_params_len = @intCast(u32, fn_ty.fnParamLen()); - try inner_block.instructions.ensureTotalCapacity(gpa, runtime_params_len); + try inner_block.instructions.ensureTotalCapacityPrecise(gpa, runtime_params_len); try sema.air_instructions.ensureUnusedCapacity(gpa, fn_info.total_params_len * 2); // * 2 for the `addType` try sema.inst_map.ensureUnusedCapacity(gpa, fn_info.total_params_len); -- cgit v1.2.3