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

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


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

commit ee47623e3b86794338de99d456a7496189c3ff47
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 ec26909761..3175637651 100644
--- a/java/org/apache/coyote/http2/Http2Parser.java
+++ b/java/org/apache/coyote/http2/Http2Parser.java
@@ -626,6 +626,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