From 51852020730bc7b072034f974f436db707ed8dcc Mon Sep 17 00:00:00 2001 From: Chris Kennelly CA Date: Fri, 18 Sep 2026 20:12:31 -0700 Subject: [PATCH] Use sized deallocation for MockSpan in linked_list_benchmark. Replace unsized delete on MockSpan with sized deallocation via MockSpan::Delete (::operator delete(s, sizeof(MockSpan))) to eliminate unsized deallocation profiling overhead and include for sized deallocation operator completeness. PiperOrigin-RevId: 984209422 --- tcmalloc/internal/linked_list_benchmark.cc | 2 +- tcmalloc/internal/mock_span.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/tcmalloc/internal/linked_list_benchmark.cc b/tcmalloc/internal/linked_list_benchmark.cc index 2db3a7bcf..4ae0e6e81 100644 --- a/tcmalloc/internal/linked_list_benchmark.cc +++ b/tcmalloc/internal/linked_list_benchmark.cc @@ -133,7 +133,7 @@ static void BM_AppendRemove(benchmark::State& state) { } for (MockSpan* s : vappend) { - delete s; + MockSpan::Delete(s); } } diff --git a/tcmalloc/internal/mock_span.h b/tcmalloc/internal/mock_span.h index 0002831a6..07a5af615 100644 --- a/tcmalloc/internal/mock_span.h +++ b/tcmalloc/internal/mock_span.h @@ -15,6 +15,8 @@ #ifndef TCMALLOC_INTERNAL_MOCK_SPAN_H_ #define TCMALLOC_INTERNAL_MOCK_SPAN_H_ +#include + #include "tcmalloc/internal/linked_list.h" namespace tcmalloc { @@ -33,6 +35,8 @@ class MockSpan : public MockSpanList::Elem { return ret; } + static void Delete(MockSpan* s) { ::operator delete(s, sizeof(MockSpan)); } + int index_; };