aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorJonas Schievink <[email protected]>2020-07-03 16:12:29 +0100
committerJonas Schievink <[email protected]>2020-07-03 16:12:29 +0100
commit93d0ac7fa0a5a9548ac07e22ac14eee46550172c (patch)
tree4c3d42bb17e0b1da3b6f084a004f548301202440 /crates
parent88a602f3057a54b924f06df263ee2830510415fa (diff)
Fix memory usage accounting for interned queries
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_ide_db/src/change.rs47
1 files changed, 30 insertions, 17 deletions
diff --git a/crates/ra_ide_db/src/change.rs b/crates/ra_ide_db/src/change.rs
index dbe6eacc5..2504d7a33 100644
--- a/crates/ra_ide_db/src/change.rs
+++ b/crates/ra_ide_db/src/change.rs
@@ -191,12 +191,10 @@ impl RootDatabase {
191 191
192 // AstDatabase 192 // AstDatabase
193 hir::db::AstIdMapQuery 193 hir::db::AstIdMapQuery
194 hir::db::InternMacroQuery
195 hir::db::MacroArgQuery 194 hir::db::MacroArgQuery
196 hir::db::MacroDefQuery 195 hir::db::MacroDefQuery
197 hir::db::ParseMacroQuery 196 hir::db::ParseMacroQuery
198 hir::db::MacroExpandQuery 197 hir::db::MacroExpandQuery
199 hir::db::InternEagerExpansionQuery
200 198
201 // DefDatabase 199 // DefDatabase
202 hir::db::ItemTreeQuery 200 hir::db::ItemTreeQuery
@@ -221,17 +219,6 @@ impl RootDatabase {
221 hir::db::DocumentationQuery 219 hir::db::DocumentationQuery
222 hir::db::ImportMapQuery 220 hir::db::ImportMapQuery
223 221
224 // InternDatabase
225 hir::db::InternFunctionQuery
226 hir::db::InternStructQuery
227 hir::db::InternUnionQuery
228 hir::db::InternEnumQuery
229 hir::db::InternConstQuery
230 hir::db::InternStaticQuery
231 hir::db::InternTraitQuery
232 hir::db::InternTypeAliasQuery
233 hir::db::InternImplQuery
234
235 // HirDatabase 222 // HirDatabase
236 hir::db::InferQueryQuery 223 hir::db::InferQueryQuery
237 hir::db::TyQuery 224 hir::db::TyQuery
@@ -246,10 +233,6 @@ impl RootDatabase {
246 hir::db::InherentImplsInCrateQuery 233 hir::db::InherentImplsInCrateQuery
247 hir::db::TraitImplsInCrateQuery 234 hir::db::TraitImplsInCrateQuery
248 hir::db::TraitImplsInDepsQuery 235 hir::db::TraitImplsInDepsQuery
249 hir::db::InternTypeCtorQuery
250 hir::db::InternTypeParamIdQuery
251 hir::db::InternChalkImplQuery
252 hir::db::InternAssocTyValueQuery
253 hir::db::AssociatedTyDataQuery 236 hir::db::AssociatedTyDataQuery
254 hir::db::TraitDatumQuery 237 hir::db::TraitDatumQuery
255 hir::db::StructDatumQuery 238 hir::db::StructDatumQuery
@@ -264,6 +247,36 @@ impl RootDatabase {
264 // LineIndexDatabase 247 // LineIndexDatabase
265 crate::LineIndexQuery 248 crate::LineIndexQuery
266 ]; 249 ];
250
251 // To collect interned data, we need to bump the revision counter by performing a synthetic
252 // write.
253 // We do this after collecting the non-interned queries to correctly attribute memory used
254 // by interned data.
255 self.runtime.synthetic_write(Durability::HIGH);
256
257 sweep_each_query![
258 // AstDatabase
259 hir::db::InternMacroQuery
260 hir::db::InternEagerExpansionQuery
261
262 // InternDatabase
263 hir::db::InternFunctionQuery
264 hir::db::InternStructQuery
265 hir::db::InternUnionQuery
266 hir::db::InternEnumQuery
267 hir::db::InternConstQuery
268 hir::db::InternStaticQuery
269 hir::db::InternTraitQuery
270 hir::db::InternTypeAliasQuery
271 hir::db::InternImplQuery
272
273 // HirDatabase
274 hir::db::InternTypeCtorQuery
275 hir::db::InternTypeParamIdQuery
276 hir::db::InternChalkImplQuery
277 hir::db::InternAssocTyValueQuery
278 ];
279
267 acc.sort_by_key(|it| std::cmp::Reverse(it.1)); 280 acc.sort_by_key(|it| std::cmp::Reverse(it.1));
268 acc 281 acc
269 } 282 }