Fix inferred types memory leak (#1566)
This commit is contained in:
parent
bf0ec2c9c8
commit
1ac7b92b45
|
|
@ -648,9 +648,17 @@ impl TypingContext {
|
|||
/// and store them in the `inferred` field. The proto network has to be topologically sorted
|
||||
/// and contain fully resolved stable node ids.
|
||||
pub fn update(&mut self, network: &ProtoNetwork) -> Result<(), GraphErrors> {
|
||||
let mut deleted_nodes = self.inferred.keys().copied().collect::<HashSet<_>>();
|
||||
|
||||
for (id, node) in network.nodes.iter() {
|
||||
self.infer(*id, node)?;
|
||||
deleted_nodes.remove(id);
|
||||
}
|
||||
|
||||
for node in deleted_nodes {
|
||||
self.inferred.remove(&node);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue