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 #7

Closed
nikomatsakis opened this issue Oct 1, 2018 · 4 comments
Closed

Garbage collection #7

nikomatsakis opened this issue Oct 1, 2018 · 4 comments
Labels
rfc Active discussion about a possible future feature

Comments

@nikomatsakis
Copy link
Member

As currently implemented, old query results are going to pile up in the hash tables. We need a method that allows users to specify a root set of query results -- that is, queries plus keys. We can then trace all the values reachable from there and evict the rest.

@matklad
Copy link
Member

matklad commented Oct 1, 2018

It might be useful to GC dependencies of roots as well. For example, when processing a rarely-changed crate, you might want to parse all files, compute available items and symbol indexes, and then throw-away intermediate results (syntax trees) to save memory.

@nikomatsakis
Copy link
Member Author

Yes, good point.

@nikomatsakis nikomatsakis added the rfc Active discussion about a possible future feature label Oct 1, 2018
@nikomatsakis nikomatsakis added this to the 1.0 milestone Oct 1, 2018
@nikomatsakis
Copy link
Member Author

nikomatsakis commented Oct 16, 2018

So what are the options we need here:

  • Some way to specify a set of root queries (probably root queries + keys?)
  • Some kind of modes:
    • Keep anything reachable from roots (default)
    • Memory saver (reduces ability to do incremental updates, but saves memory)

If trying to save memory, there are a few more options:

  • Drop memoized values from intermediate nodes but keep other info
  • Drop all intermediate nodes (no ability to do incremental updates, but saves more memory)
  • Perhaps some way to specify on a per-query basis whether they get dropped?

@matklad
Copy link
Member

matklad commented Oct 16, 2018

We can also implement LRU using the existing verified_at field.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rfc Active discussion about a possible future feature
Projects
None yet
Development

No branches or pull requests

2 participants