[PATCH] D129897: [lsan][Darwin][nfc] Fix thread vector size

Leonard Grey via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 15 12:41:26 PDT 2022


lgrey created this revision.
lgrey added a reviewer: yln.
Herald added a subscriber: Enna1.
Herald added a project: All.
lgrey requested review of this revision.
Herald added a project: Sanitizers.
Herald added a subscriber: Sanitizers.

The reserve constructor was removed in 44f55509d75d8c67077810bb6d9f3bedaea05831 but this one was missed. 
As a result, we attempt to iterate through 1024 threads each time.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D129897

Files:
  compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_mac.cpp


Index: compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_mac.cpp
===================================================================
--- compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_mac.cpp
+++ compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_mac.cpp
@@ -29,7 +29,9 @@
 
 class SuspendedThreadsListMac final : public SuspendedThreadsList {
  public:
-  SuspendedThreadsListMac() : threads_(1024) {}
+  SuspendedThreadsListMac() : threads_() {
+    threads_.reserve(1024);
+  }
 
   tid_t GetThreadID(uptr index) const override;
   thread_t GetThread(uptr index) const;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129897.445106.patch
Type: text/x-patch
Size: 593 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220715/f60b7f18/attachment.bin>


More information about the llvm-commits mailing list