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

cmcfarlen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new c98e6e347c Use malloc allocated buffers for h2 headers if enabled 
(#12767)
c98e6e347c is described below

commit c98e6e347c6065cbaeb89bacd2f924bc1495cd71
Author: Chris McFarlen <[email protected]>
AuthorDate: Tue Jan 6 11:36:21 2026 -0600

    Use malloc allocated buffers for h2 headers if enabled (#12767)
---
 include/proxy/http2/Http2CommonSession.h |  4 ++++
 include/proxy/http2/Http2Stream.h        | 10 +++++++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/include/proxy/http2/Http2CommonSession.h 
b/include/proxy/http2/Http2CommonSession.h
index cb61107fe9..0b1d9b8112 100644
--- a/include/proxy/http2/Http2CommonSession.h
+++ b/include/proxy/http2/Http2CommonSession.h
@@ -60,7 +60,11 @@ enum class Http2SsnMilestone {
   LAST_ENTRY,
 };
 
+#if TS_USE_MALLOC_ALLOCATOR
+size_t const HTTP2_HEADER_BUFFER_SIZE_INDEX = 
BUFFER_SIZE_INDEX_FOR_XMALLOC_SIZE(4096);
+#else
 size_t const HTTP2_HEADER_BUFFER_SIZE_INDEX = BUFFER_SIZE_INDEX_4K;
+#endif
 
 /**
    @startuml
diff --git a/include/proxy/http2/Http2Stream.h 
b/include/proxy/http2/Http2Stream.h
index f9961e777b..2ba9f61361 100644
--- a/include/proxy/http2/Http2Stream.h
+++ b/include/proxy/http2/Http2Stream.h
@@ -209,10 +209,14 @@ private:
   Http2StreamState _state      = Http2StreamState::HTTP2_STREAM_STATE_IDLE;
   int64_t          _http_sm_id = -1;
 
-  HTTPHdr   _receive_header;
+  HTTPHdr _receive_header;
+#if TS_USE_MALLOC_ALLOCATOR
+  MIOBuffer _receive_buffer{BUFFER_SIZE_INDEX_FOR_XMALLOC_SIZE(4096)};
+#else
   MIOBuffer _receive_buffer{BUFFER_SIZE_INDEX_4K};
-  VIO       read_vio;
-  VIO       write_vio;
+#endif
+  VIO read_vio;
+  VIO write_vio;
 
   History<HISTORY_DEFAULT_SIZE>                                                
           _history;
   Milestones<Http2StreamMilestone, 
static_cast<size_t>(Http2StreamMilestone::LAST_ENTRY)> _milestones;

Reply via email to