Merge pull request #20882 from ChayimFriedman2/accurate-mem-report
internal: Clear next-solver cache before reporting memory usage in analysis-stats
This commit is contained in:
commit
fe17c400de
3 changed files with 12 additions and 0 deletions
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
use std::{fmt, ops::ControlFlow};
|
||||
|
||||
pub use tls_cache::clear_tls_solver_cache;
|
||||
pub use tls_db::{attach_db, attach_db_allow_change, with_attached_db};
|
||||
|
||||
use base_db::Crate;
|
||||
|
|
@ -2239,4 +2240,12 @@ mod tls_cache {
|
|||
})
|
||||
})
|
||||
}
|
||||
|
||||
/// Clears the thread-local trait solver cache.
|
||||
///
|
||||
/// Should be called before getting memory usage estimations, as the solver cache
|
||||
/// is per-revision and usually should be excluded from estimations.
|
||||
pub fn clear_tls_solver_cache() {
|
||||
GLOBAL_CACHE.with_borrow_mut(|handle| *handle = None);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -171,6 +171,7 @@ pub use {
|
|||
method_resolution::TyFingerprint,
|
||||
mir::{MirEvalError, MirLowerError},
|
||||
next_solver::abi::Safety,
|
||||
next_solver::clear_tls_solver_cache,
|
||||
},
|
||||
intern::{Symbol, sym},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -345,6 +345,8 @@ impl flags::AnalysisStats {
|
|||
self.run_term_search(&workspace, db, &vfs, &file_ids, verbosity);
|
||||
}
|
||||
|
||||
hir::clear_tls_solver_cache();
|
||||
|
||||
let db = host.raw_database_mut();
|
||||
db.trigger_lru_eviction();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue