[Lldb-commits] [lldb] ee39417 - Refine memory buffer for importing shared cache objc class list

Jason Molenda via lldb-commits lldb-commits at lists.llvm.org
Tue Apr 5 12:49:46 PDT 2022


Author: Jason Molenda
Date: 2022-04-05T12:49:40-07:00
New Revision: ee394177e6b797917e4d8e0d786d84046599d2c5

URL: https://github.com/llvm/llvm-project/commit/ee394177e6b797917e4d8e0d786d84046599d2c5
DIFF: https://github.com/llvm/llvm-project/commit/ee394177e6b797917e4d8e0d786d84046599d2c5.diff

LOG: Refine memory buffer for importing shared cache objc class list

In https://reviews.llvm.org/D118972 I increased this buffer to be
big enough to import 261,144 classes but this is a lot more than
we currently have, an allocating a too-large buffer can add memory
pressure even if it's only for a short time.  Reduce the size of
this memory buffer to big enough to import 163,840 classes.  I'll
probably move to a scheme where we read the objc classes in chunks,
with a smaller buffer and multiple inferior function calls.

rdar://91275493

Added: 
    

Modified: 
    lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
index e6e12a631088a..32d3527ea10c6 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -2010,7 +2010,8 @@ AppleObjCRuntimeV2::SharedCacheClassInfoExtractor::UpdateISAToDescriptorMap() {
     return DescriptorMapUpdateResult::Fail();
 
   // The number of entries to pre-allocate room for.
-  const uint32_t max_num_classes = 256 * 1024;
+  // Each entry is (addrsize + 4) bytes
+  const uint32_t max_num_classes = 163840;
 
   UtilityFunction *get_class_info_code = GetClassInfoUtilityFunction(exe_ctx);
   if (!get_class_info_code) {


        


More information about the lldb-commits mailing list