From 52fdeb642b7b5db63323c4c36842950fb675778a Mon Sep 17 00:00:00 2001 From: Matt Brown Date: Fri, 6 Oct 2023 19:09:01 -0400 Subject: [PATCH] Reduce memory usage in language server by not caching AST --- src/file_scanner_analyzer/scanner.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/file_scanner_analyzer/scanner.rs b/src/file_scanner_analyzer/scanner.rs index a8478c77..3a83bfe9 100644 --- a/src/file_scanner_analyzer/scanner.rs +++ b/src/file_scanner_analyzer/scanner.rs @@ -330,7 +330,7 @@ pub fn scan_files( !test_patterns.iter().any(|p| p.matches(&str_path)), &logger, ) { - if analyze_map.contains(&str_path) { + if !config.ast_diff && analyze_map.contains(&str_path) { asts.lock().unwrap().insert(**file_path, scanner_result.1); } @@ -405,7 +405,7 @@ pub fn scan_files( !test_patterns.iter().any(|p| p.matches(&str_path)), &logger.clone(), ) { - if analyze_map.contains(&str_path) { + if !config.ast_diff && analyze_map.contains(&str_path) { local_asts.insert(*file_path, scanner_result.1); } @@ -490,10 +490,6 @@ pub fn scan_files( } } - codebase.classlike_infos.shrink_to_fit(); - codebase.functionlike_infos.shrink_to_fit(); - codebase.type_definitions.shrink_to_fit(); - Ok(ScanFilesResult { codebase, interner,