diff options
| author | Kirill Bobyrev <kbobyrev.opensource@gmail.com> | 2018-09-26 15:06:23 +0000 |
|---|---|---|
| committer | Kirill Bobyrev <kbobyrev.opensource@gmail.com> | 2018-09-26 15:06:23 +0000 |
| commit | ea4f20c6bef7ee65a820e65f93efe0af97997a14 (patch) | |
| tree | cd16956d5f8ada3455914d4b050644897f3657b7 /clang-tools-extra/clangd/index/Serialization.cpp | |
| parent | 0cdf629394ac6b4081aa8952d99442e8c1f313d8 (diff) | |
| download | bcm5719-llvm-ea4f20c6bef7ee65a820e65f93efe0af97997a14.tar.gz bcm5719-llvm-ea4f20c6bef7ee65a820e65f93efe0af97997a14.zip | |
[clangd] Fix bugs with incorrect memory estimate report
* With the current implementation, `sizeof(std::vector<Chunk>)` is added
twice to the `Dex` memory estimate which is incorrect
* `Dex` logs memory usage estimation before `BackingDataSize` is set and
hence the log report excludes size of the external `SymbolSlab` which is
coupled with `Dex` instance
Reviewed By: ioeric
Differential Revision: https://reviews.llvm.org/D52503
llvm-svn: 343117
Diffstat (limited to 'clang-tools-extra/clangd/index/Serialization.cpp')
| -rw-r--r-- | clang-tools-extra/clangd/index/Serialization.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/clang-tools-extra/clangd/index/Serialization.cpp b/clang-tools-extra/clangd/index/Serialization.cpp index 4f5413a7ecf..5e16137f8b2 100644 --- a/clang-tools-extra/clangd/index/Serialization.cpp +++ b/clang-tools-extra/clangd/index/Serialization.cpp @@ -6,8 +6,10 @@ // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// + #include "Serialization.h" #include "Index.h" +#include "Logger.h" #include "RIFF.h" #include "Trace.h" #include "dex/Dex.h" @@ -433,8 +435,12 @@ std::unique_ptr<SymbolIndex> loadIndex(llvm::StringRef SymbolFilename, } trace::Span Tracer("BuildIndex"); - return UseDex ? dex::Dex::build(std::move(Symbols), URISchemes) - : MemIndex::build(std::move(Symbols), std::move(Refs)); + auto Index = UseDex ? dex::Dex::build(std::move(Symbols), URISchemes) + : MemIndex::build(std::move(Symbols), std::move(Refs)); + vlog("Loaded {0} from {1} with estimated memory usage {2}", + UseDex ? "Dex" : "MemIndex", SymbolFilename, + Index->estimateMemoryUsage()); + return Index; } } // namespace clangd |

