Use malloc allocated buffers for h2 headers if enabled#12767
Merged
cmcfarlen merged 1 commit intoapache:masterfrom Jan 6, 2026
Merged
Use malloc allocated buffers for h2 headers if enabled#12767cmcfarlen merged 1 commit intoapache:masterfrom
cmcfarlen merged 1 commit intoapache:masterfrom
Conversation
bneradt
requested changes
Dec 30, 2025
Comment on lines
+213
to
+217
| #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 |
Contributor
There was a problem hiding this comment.
Can HTTP2_HEADER_BUFFER_SIZE_INDEX be constexpr so that _receive_buffer is allocated with that value? Or do compilers not like that?
Contributor
Author
There was a problem hiding this comment.
The issue here is the visibility of HTTP2_HEADER_BUFFER_SIZE_INDEX. It's not included from this file. I didn't want to change the dependencies of the files. I presume that was why it didn't previously use the buffer size index.
I couldn't find any good common header to move the definition to either.
Contributor
There was a problem hiding this comment.
Sounds good. Thanks for interacting with the idea.
bneradt
approved these changes
Jan 6, 2026
Contributor
Author
|
Cherry-picked to 10.1.x branch |
cmcfarlen
added a commit
that referenced
this pull request
Jan 12, 2026
(cherry picked from commit c98e6e3)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Internal testing shows this change increased performance on high RPS setups enough to warrant a code change. I've conditioned this change on the existing
ENABLE_MALLOC_ALLOCATORbuild flag so that it's opt-in.