[PATCH] D51154: [clangd] Log memory usage of DexIndex and MemIndex

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 23 06:08:20 PDT 2018


ilya-biryukov added a comment.

Some drive-by NITS.



================
Comment at: clang-tools-extra/clangd/index/MemIndex.cpp:109
+    std::lock_guard<std::mutex> Lock(Mutex);
+
+    Bytes += Index.getMemorySize();
----------------
Why not simply `return Index.getMemorySize()` under a lock?


================
Comment at: clang-tools-extra/clangd/index/dex/DexIndex.cpp:180
+  {
+    std::lock_guard<std::mutex> Lock(Mutex);
+
----------------
Maybe put a lock over all of the function and remove the unneeded compound statement?


https://reviews.llvm.org/D51154





More information about the cfe-commits mailing list