From edd4a83ee3c887670afd077eeb1ddb8ce1976108 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 22 Jul 2020 18:44:40 +0200 Subject: Use salsa's purge to account for all memory --- crates/ra_db/Cargo.toml | 2 +- crates/ra_hir/src/db.rs | 9 +-------- crates/ra_ide_db/src/change.rs | 24 +++++++++++++++++++++++- 3 files changed, 25 insertions(+), 10 deletions(-) (limited to 'crates') diff --git a/crates/ra_db/Cargo.toml b/crates/ra_db/Cargo.toml index 5f334d04f..fe73dc015 100644 --- a/crates/ra_db/Cargo.toml +++ b/crates/ra_db/Cargo.toml @@ -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" } diff --git a/crates/ra_hir/src/db.rs b/crates/ra_hir/src/db.rs index a2b9f3e35..07333c453 100644 --- a/crates/ra_hir/src/db.rs +++ b/crates/ra_hir/src/db.rs @@ -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() { diff --git a/crates/ra_ide_db/src/change.rs b/crates/ra_ide_db/src/change.rs index 32d9a8d1f..b13df8b85 100644 --- a/crates/ra_ide_db/src/change.rs +++ b/crates/ra_ide_db/src/change.rs @@ -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 @@ -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 -- cgit v1.2.3