diff options
author | Aleksey Kladov <[email protected]> | 2020-07-22 17:44:40 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-08-05 14:28:20 +0100 |
commit | edd4a83ee3c887670afd077eeb1ddb8ce1976108 (patch) | |
tree | 125d7a89eaa87938ef0e2b8e074bccb1a353fc50 /crates | |
parent | 2ad29eb23167273f2e101b44c1f21b4ec2821bc2 (diff) |
Use salsa's purge to account for all memory
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_db/Cargo.toml | 2 | ||||
-rw-r--r-- | crates/ra_hir/src/db.rs | 9 | ||||
-rw-r--r-- | crates/ra_ide_db/src/change.rs | 24 |
3 files changed, 25 insertions, 10 deletions
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" | |||
9 | doctest = false | 9 | doctest = false |
10 | 10 | ||
11 | [dependencies] | 11 | [dependencies] |
12 | salsa = "0.15.0" | 12 | salsa = "0.15.2" |
13 | rustc-hash = "1.1.0" | 13 | rustc-hash = "1.1.0" |
14 | 14 | ||
15 | ra_syntax = { path = "../ra_syntax" } | 15 | 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::{ | |||
13 | AstDatabase, AstDatabaseStorage, AstIdMapQuery, InternEagerExpansionQuery, InternMacroQuery, | 13 | AstDatabase, AstDatabaseStorage, AstIdMapQuery, InternEagerExpansionQuery, InternMacroQuery, |
14 | MacroArgTextQuery, MacroDefQuery, MacroExpandQuery, ParseMacroQuery, | 14 | MacroArgTextQuery, MacroDefQuery, MacroExpandQuery, ParseMacroQuery, |
15 | }; | 15 | }; |
16 | pub use hir_ty::db::{ | 16 | pub use hir_ty::db::*; |
17 | AssociatedTyDataQuery, AssociatedTyValueQuery, CallableItemSignatureQuery, FieldTypesQuery, | ||
18 | GenericDefaultsQuery, GenericPredicatesForParamQuery, GenericPredicatesQuery, HirDatabase, | ||
19 | HirDatabaseStorage, ImplDatumQuery, ImplSelfTyQuery, ImplTraitQuery, InferQueryQuery, | ||
20 | InherentImplsInCrateQuery, InternTypeParamIdQuery, ReturnTypeImplTraitsQuery, StructDatumQuery, | ||
21 | TraitDatumQuery, TraitImplsInCrateQuery, TraitImplsInDepsQuery, TraitSolveQuery, TyQuery, | ||
22 | ValueTyQuery, | ||
23 | }; | ||
24 | 17 | ||
25 | #[test] | 18 | #[test] |
26 | fn hir_database_is_object_safe() { | 19 | 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 { | |||
190 | let q: $q = Default::default(); | 190 | let q: $q = Default::default(); |
191 | let name = format!("{:?} (deps)", q); | 191 | let name = format!("{:?} (deps)", q); |
192 | acc.push((name, before - after)); | 192 | acc.push((name, before - after)); |
193 | |||
194 | let before = memory_usage().allocated; | ||
195 | $q.in_db(self).purge(); | ||
196 | let after = memory_usage().allocated; | ||
197 | let q: $q = Default::default(); | ||
198 | let name = format!("{:?} (purge)", q); | ||
199 | acc.push((name, before - after)); | ||
193 | )*} | 200 | )*} |
194 | } | 201 | } |
195 | sweep_each_query![ | 202 | sweep_each_query![ |
196 | // SourceDatabase | 203 | // SourceDatabase |
197 | ra_db::ParseQuery | 204 | ra_db::ParseQuery |
205 | ra_db::CrateGraphQuery | ||
206 | |||
207 | // SourceDatabaseExt | ||
208 | ra_db::FileTextQuery | ||
209 | ra_db::FileSourceRootQuery | ||
210 | ra_db::SourceRootQuery | ||
198 | ra_db::SourceRootCratesQuery | 211 | ra_db::SourceRootCratesQuery |
199 | 212 | ||
200 | // AstDatabase | 213 | // AstDatabase |
@@ -242,15 +255,24 @@ impl RootDatabase { | |||
242 | hir::db::TraitImplsInCrateQuery | 255 | hir::db::TraitImplsInCrateQuery |
243 | hir::db::TraitImplsInDepsQuery | 256 | hir::db::TraitImplsInDepsQuery |
244 | hir::db::AssociatedTyDataQuery | 257 | hir::db::AssociatedTyDataQuery |
258 | hir::db::AssociatedTyDataQuery | ||
245 | hir::db::TraitDatumQuery | 259 | hir::db::TraitDatumQuery |
246 | hir::db::StructDatumQuery | 260 | hir::db::StructDatumQuery |
247 | hir::db::ImplDatumQuery | 261 | hir::db::ImplDatumQuery |
262 | hir::db::FnDefDatumQuery | ||
263 | hir::db::ReturnTypeImplTraitsQuery | ||
264 | hir::db::InternCallableDefQuery | ||
265 | hir::db::InternTypeParamIdQuery | ||
266 | hir::db::InternImplTraitIdQuery | ||
267 | hir::db::InternClosureQuery | ||
248 | hir::db::AssociatedTyValueQuery | 268 | hir::db::AssociatedTyValueQuery |
249 | hir::db::TraitSolveQuery | 269 | hir::db::TraitSolveQuery |
250 | hir::db::ReturnTypeImplTraitsQuery | ||
251 | 270 | ||
252 | // SymbolsDatabase | 271 | // SymbolsDatabase |
253 | crate::symbol_index::FileSymbolsQuery | 272 | crate::symbol_index::FileSymbolsQuery |
273 | crate::symbol_index::LibrarySymbolsQuery | ||
274 | crate::symbol_index::LocalRootsQuery | ||
275 | crate::symbol_index::LibraryRootsQuery | ||
254 | 276 | ||
255 | // LineIndexDatabase | 277 | // LineIndexDatabase |
256 | crate::LineIndexQuery | 278 | crate::LineIndexQuery |