[all-commits] [llvm/llvm-project] b8c371: [clangd] Trim memory periodically when using glibc...
Quentin Chateau via All-commits
all-commits at lists.llvm.org
Mon Dec 21 23:55:00 PST 2020
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: b8c37153d5393aad96feefe0b4689b7b62bc160d
https://github.com/llvm/llvm-project/commit/b8c37153d5393aad96feefe0b4689b7b62bc160d
Author: Quentin Chateau <quentin.chateau at gmail.com>
Date: 2020-12-22 (Tue, 22 Dec 2020)
Changed paths:
M clang-tools-extra/clangd/CMakeLists.txt
M clang-tools-extra/clangd/ClangdLSPServer.cpp
M clang-tools-extra/clangd/ClangdLSPServer.h
M clang-tools-extra/clangd/Features.inc.in
M clang-tools-extra/clangd/tool/ClangdMain.cpp
Log Message:
-----------
[clangd] Trim memory periodically when using glibc malloc
This diff addresses the issue of the ever increasing memory usage of clangd. The key to understand what happens is to use `malloc_stats()`: malloc arenas keep getting bigger, although the actual memory used does not. It seems some operations while bulding the indices (both dynamic and background) create this problem. Specifically, 'FileSymbols::update' and 'FileSymbols::buildIndex' seem especially affected.
This diff adds a call to `malloc_trim()` periodically in
ClangdLSPServer.
Fixes: https://github.com/clangd/clangd/issues/251
Fixes: https://github.com/clangd/clangd/issues/115
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D93452
More information about the All-commits
mailing list