From 77879c4be7ec1cf8121b2a64d2f21c8f9b880f18 Mon Sep 17 00:00:00 2001 From: Yousuk Seung Date: Fri, 23 Feb 2024 16:10:43 -0800 Subject: [PATCH] Clarify caller should call dtor with New() PiperOrigin-RevId: 609863609 --- src/core/lib/resource_quota/arena.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/core/lib/resource_quota/arena.h b/src/core/lib/resource_quota/arena.h index edcab2caf87..fdc93621c3c 100644 --- a/src/core/lib/resource_quota/arena.h +++ b/src/core/lib/resource_quota/arena.h @@ -173,6 +173,8 @@ class Arena { } } + // Allocates T from the arena. + // The caller is responsible for calling p->~T(), but should NOT delete. // TODO(roth): We currently assume that all callers need alignment of 16 // bytes, which may be wrong in some cases. When we have time, we should // change this to instead use the alignment of the type being allocated by @@ -185,6 +187,7 @@ class Arena { } // Like New, but has the arena call p->~T() at arena destruction time. + // The caller should NOT delete. template T* ManagedNew(Args&&... args) { auto* p = New>(std::forward(args)...);