Skip to content

Commit 334680d

Browse files
committed
analysis-stats: run Salsa's LRU at the end of analysis
1 parent f443ba0 commit 334680d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

crates/rust-analyzer/src/cli/analysis_stats.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ use ide::{
2222
Analysis, AnalysisHost, AnnotationConfig, DiagnosticsConfig, Edition, InlayFieldsToResolve,
2323
InlayHintsConfig, LineCol, RootDatabase,
2424
};
25-
use ide_db::{EditionedFileId, LineIndexDatabase, SnippetCap, base_db::SourceDatabase};
25+
use ide_db::{
26+
EditionedFileId, LineIndexDatabase, SnippetCap,
27+
base_db::{SourceDatabase, salsa::Database},
28+
};
2629
use itertools::Itertools;
2730
use load_cargo::{LoadCargoConfig, ProcMacroServerChoice, load_workspace};
2831
use oorandom::Rand32;
@@ -104,7 +107,7 @@ impl flags::AnalysisStats {
104107
}
105108
eprintln!(")");
106109

107-
let host = AnalysisHost::with_database(db);
110+
let mut host = AnalysisHost::with_database(db);
108111
let db = host.raw_database();
109112

110113
let mut analysis_sw = self.stop_watch();
@@ -256,6 +259,8 @@ impl flags::AnalysisStats {
256259
if let Some(instructions) = total_span.instructions {
257260
report_metric("total instructions", instructions, "#instr");
258261
}
262+
let db = host.raw_database_mut();
263+
db.trigger_lru_eviction();
259264
report_metric("total memory", total_span.memory.allocated.megabytes() as u64, "MB");
260265

261266
if self.source_stats {

0 commit comments

Comments
 (0)