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

markt pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/10.1.x by this push:
     new cbdf826025 Clear reference to stream in HPack decoder once headers are 
processed
cbdf826025 is described below

commit cbdf826025b720645adedd1735b7ff23ad6d8316
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri Jan 10 10:54:31 2025 +0000

    Clear reference to stream in HPack decoder once headers are processed
---
 java/org/apache/coyote/http2/HpackDecoder.java | 5 +++++
 java/org/apache/coyote/http2/Http2Parser.java  | 6 ++++++
 2 files changed, 11 insertions(+)

diff --git a/java/org/apache/coyote/http2/HpackDecoder.java 
b/java/org/apache/coyote/http2/HpackDecoder.java
index 1d04406892..5257802285 100644
--- a/java/org/apache/coyote/http2/HpackDecoder.java
+++ b/java/org/apache/coyote/http2/HpackDecoder.java
@@ -405,6 +405,11 @@ public class HpackDecoder {
     }
 
 
+    void clearHeaderEmitter() {
+        headerEmitter = null;
+    }
+
+
     void setMaxHeaderCount(int maxHeaderCount) {
         this.maxHeaderCount = maxHeaderCount;
     }
diff --git a/java/org/apache/coyote/http2/Http2Parser.java 
b/java/org/apache/coyote/http2/Http2Parser.java
index b9f95e3cd7..9a22348e94 100644
--- a/java/org/apache/coyote/http2/Http2Parser.java
+++ b/java/org/apache/coyote/http2/Http2Parser.java
@@ -643,6 +643,12 @@ class Http2Parser {
                     Http2Error.COMPRESSION_ERROR);
         }
 
+        /*
+         * Clear the reference to the stream in the HPack decoder now that the 
headers have been processed so that the
+         * HPack decoder does not retain a reference to this stream. This aids 
GC.
+         */
+        hpackDecoder.clearHeaderEmitter();
+
         synchronized (output) {
             output.headersEnd(streamId, headersEndStream);
 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to