Skip to content

Commit bd255d1

Browse files
committed
Drop proc bodies after find-usages finishes
1 parent 3bc83b1 commit bd255d1

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

src/dreammaker/objtree.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,6 +1008,17 @@ impl ObjectTree {
10081008

10091009
self.register_proc(context, location, parent, proc_name, declaration, parameters, code)
10101010
}
1011+
1012+
/// Drop all code ASTs to attempt to reduce memory usage.
1013+
pub fn drop_code(&mut self) {
1014+
for node in self.graph.node_weights_mut() {
1015+
for (_, typroc) in node.procs.iter_mut() {
1016+
for proc in typroc.value.iter_mut() {
1017+
proc.code = Code::Disabled;
1018+
}
1019+
}
1020+
}
1021+
}
10111022
}
10121023

10131024
#[inline]

src/langserver/main.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,8 @@ impl<'a, W: io::ResponseWrite> Engine<'a, W> {
400400
);
401401
}
402402

403+
self.objtree.drop_code();
404+
403405
Ok(())
404406
}
405407

0 commit comments

Comments
 (0)