Skip to content

Commit c6a9838

Browse files
ckennellycopybara-github
authored andcommitted
Strengthen debug double-free protections.
If a batch (currently always size()=1, though) would cause the span to become free, we do not get an opportunity to cross-check other data like the free object bitmap (>=64 byte objects for the 8KB page size). PiperOrigin-RevId: 803632371 Change-Id: Ic8ea3b04f079afcd6ff94d3ab929653efe8bb63f
1 parent 1278792 commit c6a9838

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tcmalloc/span.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ inline bool Span::FreelistPushBatch(absl::Span<void*> batch, size_t size,
393393
uint32_t reciprocal) {
394394
TC_ASSERT(!is_large_or_sampled());
395395
const auto allocated = allocated_.load(std::memory_order_relaxed);
396-
TC_ASSERT_GT(allocated, 0);
396+
TC_ASSERT_GE(allocated, batch.size());
397397
if (ABSL_PREDICT_FALSE(allocated == batch.size())) {
398398
return false;
399399
}

0 commit comments

Comments
 (0)