[PATCH] D62623: Reduce memory consumption of coverage dumps

serge via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 4 14:46:03 PDT 2019


serge-sans-paille added inline comments.


================
Comment at: clang/lib/CodeGen/CoverageMappingGen.cpp:1393
+  size_t CoverageMappingSize = 0;
+  for (auto &S : CoverageMappings) {
+    CoverageMappingSize += S.size();
----------------
vsk wrote:
> It doesn't look like the CoverageMappings std::vector is needed at all. Consider moving `FilenamesAndCoverageMappings` into CoverageMappingModuleGen?
> 
> That should reduce the memory requirements a bit more.
It's not possible to directly store into `FilenamesAndCoverageMappings` because filenames need to be stored before all mappings. It's possible to use a `std::string` instead of a `std::vector` but it means that at some point, memory usage will be `| CoverageMappings| x 2` while if we empty the vector elements as we push them to the stream, we should keep `|CoverageMappings|`. I've updated the diff to enforce this stream behavior.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62623/new/

https://reviews.llvm.org/D62623





More information about the cfe-commits mailing list