Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Garbage collection #154

Open
SHoltzen opened this issue Jul 23, 2023 · 0 comments
Open

Garbage collection #154

SHoltzen opened this issue Jul 23, 2023 · 0 comments

Comments

@SHoltzen
Copy link
Collaborator

SHoltzen commented Jul 23, 2023

Currently all nodes that are allocated by the bottom-up managers are never deallocated. This issue establishes a garbage collection interface for collecting unused nodes. It adds the following method to the BottomUpBuilder trait:

pub trait BottomUpBuilder<'a, Ptr> {
    ...
    /// garbage collects all nodes in the builder.
    /// only the roots provided in the `roots` argument are guaranteed to be preserved. 
    /// Roots may be moved during garbage collection; these new roots are returned in the 
    /// same order in which they were provided.
    fn collect(&'a self, roots: Vec<Ptr>) -> Vec<Ptr>
}

This issue involves scoping and implementing the garbage collecting strategy. Design considerations:

  • Ideally, we should not simply garbage collect all nodes that are not referenced. It's often the case that nodes that are used once are often used again.
  • Ideally, we should try to preserve as much of the apply cache as possible. We should study what cudd does and see how they manage to do it.
  • This API needs to be able to handle lifetimes. All references to pointers should become invalidated after collection (since they can all be moved). Ideally this is maintained at the type signature level. The above API does not do this; we will need to experiment and think about this. Hopefully it does not require adding a trait-level lifetime to the Ptr trait, but it might.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

No branches or pull requests

1 participant