aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/install/lockfile.zig16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/install/lockfile.zig b/src/install/lockfile.zig
index 30b1b10b0..63274cc43 100644
--- a/src/install/lockfile.zig
+++ b/src/install/lockfile.zig
@@ -2603,6 +2603,14 @@ pub const Package = extern struct {
};
};
+pub fn deinit(this: *Lockfile) void {
+ this.buffers.deinit(this.allocator);
+ this.packages.deinit(this.allocator);
+ this.unique_packages.deinit(this.allocator);
+ this.string_pool.deinit();
+ this.* = undefined;
+}
+
const Buffers = struct {
trees: Tree.List = Tree.List{},
hoisted_packages: PackageIDList = PackageIDList{},
@@ -2613,6 +2621,14 @@ const Buffers = struct {
// node_modules_package_ids: PackageIDList = PackageIDList{},
string_bytes: StringBuffer = StringBuffer{},
+ pub fn deinit(this: *Buffers, allocator: std.mem.Allocator) void {
+ try this.trees.deinit(allocator);
+ try this.resolutions.deinit(allocator);
+ try this.dependencies.deinit(allocator);
+ try this.extern_strings.deinit(allocator);
+ try this.string_bytes.deinit(allocator);
+ }
+
pub fn preallocate(this: *Buffers, that: Buffers, allocator: std.mem.Allocator) !void {
try this.trees.ensureTotalCapacity(allocator, that.trees.items.len);
try this.resolutions.ensureTotalCapacity(allocator, that.resolutions.items.len);