[Lldb-commits] [PATCH] D68549: make ConstString allocate memory in non-tiny chunks

Luboš Luňák via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Oct 11 12:36:34 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rGe2ca7cb504a8: make ConstString allocate memory in non-tiny chunks (authored by llunak).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68549

Files:
  lldb/source/Utility/ConstString.cpp


Index: lldb/source/Utility/ConstString.cpp
===================================================================
--- lldb/source/Utility/ConstString.cpp
+++ lldb/source/Utility/ConstString.cpp
@@ -31,7 +31,10 @@
 class Pool {
 public:
   typedef const char *StringPoolValueType;
-  typedef llvm::StringMap<StringPoolValueType, llvm::BumpPtrAllocator>
+  // BumpPtrAllocator allocates in 4KiB chunks, any larger C++ project is going
+  // to have megabytes of symbols, so allocate in larger chunks.
+  typedef llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 1048576> Allocator;
+  typedef llvm::StringMap<StringPoolValueType, Allocator>
       StringPool;
   typedef llvm::StringMapEntry<StringPoolValueType> StringPoolEntryType;
 
@@ -152,7 +155,9 @@
 
   struct PoolEntry {
     mutable llvm::sys::SmartRWMutex<false> m_mutex;
-    StringPool m_string_map;
+    // StringMap by default starts with 16 buckets, any larger project is
+    // going to have many symbols, so start with a larger value.
+    StringPool m_string_map = StringPool( 65536 );
   };
 
   std::array<PoolEntry, 256> m_string_pools;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68549.224657.patch
Type: text/x-patch
Size: 1105 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191011/f2a02824/attachment.bin>


More information about the lldb-commits mailing list