Skip to content

Commit

Permalink
Shrink arrays to fit
Browse files Browse the repository at this point in the history
  • Loading branch information
overlookmotel committed Sep 11, 2024
1 parent 19ab835 commit 1e9d7ef
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions crates/oxc_semantic/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,11 @@ impl<'a> SemanticBuilder<'a> {
Counts::assert_accurate(&actual_counts, &counts);
}

// Shrink arrays to required size, to recover memory
self.nodes.shrink_to(self.nodes.len());
self.scope.shrink_to(self.scope.len());
self.symbols.shrink_to(self.symbols.len(), self.symbols.references.len());

// Checking syntax error on module record requires scope information from the previous AST pass
if self.check_syntax_error {
checker::check_module_record(&self);
Expand Down

0 comments on commit 1e9d7ef

Please sign in to comment.