You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2021/07/20 22:05:04 UTC

[trafficserver] branch 9.1.x updated: Make the InkAPI mHandleAllocator be a Proxy Allocator (#8074)

This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 9.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/9.1.x by this push:
     new a92131d  Make the InkAPI mHandleAllocator be a Proxy Allocator (#8074)
a92131d is described below

commit a92131d9152dfcd1a04da27ec9f0e8d6a7a7f127
Author: Leif Hedstrom <zw...@apache.org>
AuthorDate: Tue Jul 20 12:09:26 2021 -0600

    Make the InkAPI mHandleAllocator be a Proxy Allocator (#8074)
    
    (cherry picked from commit bcb54b5ac4e796f12d0edacbb5105ded12fac2c9)
---
 iocore/eventsystem/I_Thread.h | 1 +
 src/traffic_server/InkAPI.cc  | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/iocore/eventsystem/I_Thread.h b/iocore/eventsystem/I_Thread.h
index f2f1b1c..28160b7 100644
--- a/iocore/eventsystem/I_Thread.h
+++ b/iocore/eventsystem/I_Thread.h
@@ -137,6 +137,7 @@ public:
   ProxyAllocator ioDataAllocator;
   ProxyAllocator ioAllocator;
   ProxyAllocator ioBlockAllocator;
+  ProxyAllocator mHandleAllocator;
 
   /** Start the underlying thread.
 
diff --git a/src/traffic_server/InkAPI.cc b/src/traffic_server/InkAPI.cc
index 09a6bd0..9c31884 100644
--- a/src/traffic_server/InkAPI.cc
+++ b/src/traffic_server/InkAPI.cc
@@ -772,7 +772,7 @@ isWriteable(TSMBuffer bufp)
 static MIMEFieldSDKHandle *
 sdk_alloc_field_handle(TSMBuffer /* bufp ATS_UNUSED */, MIMEHdrImpl *mh)
 {
-  MIMEFieldSDKHandle *handle = mHandleAllocator.alloc();
+  MIMEFieldSDKHandle *handle = THREAD_ALLOC(mHandleAllocator, this_thread());
 
   // TODO: Should remove this when memory allocation can't fail.
   sdk_assert(sdk_sanity_check_null_ptr((void *)handle) == TS_SUCCESS);
@@ -787,7 +787,7 @@ static void
 sdk_free_field_handle(TSMBuffer bufp, MIMEFieldSDKHandle *field_handle)
 {
   if (sdk_sanity_check_mbuffer(bufp) == TS_SUCCESS) {
-    mHandleAllocator.free(field_handle);
+    THREAD_FREE(field_handle, mHandleAllocator, this_thread());
   }
 }