Skip to content

Commit

Permalink
Merge #5494
Browse files Browse the repository at this point in the history
5494: Use salsa's purge to account for all memory r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
  • Loading branch information
bors[bot] and matklad committed Aug 5, 2020
2 parents 2ad29eb + edd4a83 commit 5721cca
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 20 deletions.
20 changes: 10 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/ra_db/Cargo.toml
Expand Up @@ -9,7 +9,7 @@ license = "MIT OR Apache-2.0"
doctest = false

[dependencies]
salsa = "0.15.0"
salsa = "0.15.2"
rustc-hash = "1.1.0"

ra_syntax = { path = "../ra_syntax" }
Expand Down
9 changes: 1 addition & 8 deletions crates/ra_hir/src/db.rs
Expand Up @@ -13,14 +13,7 @@ pub use hir_expand::db::{
AstDatabase, AstDatabaseStorage, AstIdMapQuery, InternEagerExpansionQuery, InternMacroQuery,
MacroArgTextQuery, MacroDefQuery, MacroExpandQuery, ParseMacroQuery,
};
pub use hir_ty::db::{
AssociatedTyDataQuery, AssociatedTyValueQuery, CallableItemSignatureQuery, FieldTypesQuery,
GenericDefaultsQuery, GenericPredicatesForParamQuery, GenericPredicatesQuery, HirDatabase,
HirDatabaseStorage, ImplDatumQuery, ImplSelfTyQuery, ImplTraitQuery, InferQueryQuery,
InherentImplsInCrateQuery, InternTypeParamIdQuery, ReturnTypeImplTraitsQuery, StructDatumQuery,
TraitDatumQuery, TraitImplsInCrateQuery, TraitImplsInDepsQuery, TraitSolveQuery, TyQuery,
ValueTyQuery,
};
pub use hir_ty::db::*;

#[test]
fn hir_database_is_object_safe() {
Expand Down
24 changes: 23 additions & 1 deletion crates/ra_ide_db/src/change.rs
Expand Up @@ -190,11 +190,24 @@ impl RootDatabase {
let q: $q = Default::default();
let name = format!("{:?} (deps)", q);
acc.push((name, before - after));

let before = memory_usage().allocated;
$q.in_db(self).purge();
let after = memory_usage().allocated;
let q: $q = Default::default();
let name = format!("{:?} (purge)", q);
acc.push((name, before - after));
)*}
}
sweep_each_query![
// SourceDatabase
ra_db::ParseQuery
ra_db::CrateGraphQuery

// SourceDatabaseExt
ra_db::FileTextQuery
ra_db::FileSourceRootQuery
ra_db::SourceRootQuery
ra_db::SourceRootCratesQuery

// AstDatabase
Expand Down Expand Up @@ -242,15 +255,24 @@ impl RootDatabase {
hir::db::TraitImplsInCrateQuery
hir::db::TraitImplsInDepsQuery
hir::db::AssociatedTyDataQuery
hir::db::AssociatedTyDataQuery
hir::db::TraitDatumQuery
hir::db::StructDatumQuery
hir::db::ImplDatumQuery
hir::db::FnDefDatumQuery
hir::db::ReturnTypeImplTraitsQuery
hir::db::InternCallableDefQuery
hir::db::InternTypeParamIdQuery
hir::db::InternImplTraitIdQuery
hir::db::InternClosureQuery
hir::db::AssociatedTyValueQuery
hir::db::TraitSolveQuery
hir::db::ReturnTypeImplTraitsQuery

// SymbolsDatabase
crate::symbol_index::FileSymbolsQuery
crate::symbol_index::LibrarySymbolsQuery
crate::symbol_index::LocalRootsQuery
crate::symbol_index::LibraryRootsQuery

// LineIndexDatabase
crate::LineIndexQuery
Expand Down

0 comments on commit 5721cca

Please sign in to comment.