HomePhabricator

[clangd] Trim memory periodically when using glibc malloc

Authored by qchateau on Dec 21 2020, 11:44 PM.

Description

[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

Details

Committed
sammccallDec 21 2020, 11:54 PM
Reviewer
sammccall
Differential Revision
D93452: [clangd] Trim memory periodically
Parents
rGf72c384b5ba9: [Flang][openmp][2/5] Make Default clause part of OmpClause
Branches
Unknown
Tags
Unknown