diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_persistent_allocator.h b/compiler-rt/lib/sanitizer_common/sanitizer_persistent_allocator.h --- a/compiler-rt/lib/sanitizer_common/sanitizer_persistent_allocator.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_persistent_allocator.h @@ -24,11 +24,7 @@ class PersistentAllocator { public: T *alloc(uptr count = 1); - uptr allocated() const { - SpinMutexLock l(&mtx); - return atomic_load_relaxed(&mapped_size) + - atomic_load_relaxed(®ion_pos) - atomic_load_relaxed(®ion_end); - } + uptr allocated() const { return atomic_load_relaxed(&mapped_size); } private: T *tryAlloc(uptr count); diff --git a/compiler-rt/lib/sanitizer_common/tests/sanitizer_chained_origin_depot_test.cpp b/compiler-rt/lib/sanitizer_common/tests/sanitizer_chained_origin_depot_test.cpp --- a/compiler-rt/lib/sanitizer_common/tests/sanitizer_chained_origin_depot_test.cpp +++ b/compiler-rt/lib/sanitizer_common/tests/sanitizer_chained_origin_depot_test.cpp @@ -81,10 +81,12 @@ EXPECT_EQ(stats2.n_uniq_ids, stats1.n_uniq_ids); EXPECT_EQ(stats2.allocated, stats1.allocated); - EXPECT_TRUE(chainedOriginDepot.Put(35, 36, &new_id)); - StackDepotStats stats3 = chainedOriginDepot.GetStats(); - EXPECT_EQ(stats3.n_uniq_ids, stats2.n_uniq_ids + 1); - EXPECT_GT(stats3.allocated, stats2.allocated); + for (int i = 0; i < 100000; ++i) { + ASSERT_TRUE(chainedOriginDepot.Put(35, i, &new_id)); + StackDepotStats stats3 = chainedOriginDepot.GetStats(); + ASSERT_EQ(stats3.n_uniq_ids, stats2.n_uniq_ids + 1 + i); + } + EXPECT_GT(chainedOriginDepot.GetStats().allocated, stats2.allocated); } } // namespace __sanitizer