Skip to content

Commit edd4a83

Browse files
committed
Use salsa's purge to account for all memory
1 parent 2ad29eb commit edd4a83

File tree

4 files changed

+35
-20
lines changed

4 files changed

+35
-20
lines changed

Cargo.lock

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/ra_db/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ license = "MIT OR Apache-2.0"
99
doctest = false
1010

1111
[dependencies]
12-
salsa = "0.15.0"
12+
salsa = "0.15.2"
1313
rustc-hash = "1.1.0"
1414

1515
ra_syntax = { path = "../ra_syntax" }

crates/ra_hir/src/db.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,7 @@ pub use hir_expand::db::{
1313
AstDatabase, AstDatabaseStorage, AstIdMapQuery, InternEagerExpansionQuery, InternMacroQuery,
1414
MacroArgTextQuery, MacroDefQuery, MacroExpandQuery, ParseMacroQuery,
1515
};
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-
};
16+
pub use hir_ty::db::*;
2417

2518
#[test]
2619
fn hir_database_is_object_safe() {

crates/ra_ide_db/src/change.rs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,24 @@ impl RootDatabase {
190190
let q: $q = Default::default();
191191
let name = format!("{:?} (deps)", q);
192192
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));
193200
)*}
194201
}
195202
sweep_each_query![
196203
// SourceDatabase
197204
ra_db::ParseQuery
205+
ra_db::CrateGraphQuery
206+
207+
// SourceDatabaseExt
208+
ra_db::FileTextQuery
209+
ra_db::FileSourceRootQuery
210+
ra_db::SourceRootQuery
198211
ra_db::SourceRootCratesQuery
199212

200213
// AstDatabase
@@ -242,15 +255,24 @@ impl RootDatabase {
242255
hir::db::TraitImplsInCrateQuery
243256
hir::db::TraitImplsInDepsQuery
244257
hir::db::AssociatedTyDataQuery
258+
hir::db::AssociatedTyDataQuery
245259
hir::db::TraitDatumQuery
246260
hir::db::StructDatumQuery
247261
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
248268
hir::db::AssociatedTyValueQuery
249269
hir::db::TraitSolveQuery
250-
hir::db::ReturnTypeImplTraitsQuery
251270

252271
// SymbolsDatabase
253272
crate::symbol_index::FileSymbolsQuery
273+
crate::symbol_index::LibrarySymbolsQuery
274+
crate::symbol_index::LocalRootsQuery
275+
crate::symbol_index::LibraryRootsQuery
254276

255277
// LineIndexDatabase
256278
crate::LineIndexQuery

0 commit comments

Comments
 (0)