This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 582c09fe29cf51c800988d5294016880bfba9b8a Author: Mark Thomas <ma...@apache.org> AuthorDate: Mon May 4 15:25:01 2020 +0100 Recycle in a consistent location --- java/org/apache/catalina/core/ApplicationContext.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/java/org/apache/catalina/core/ApplicationContext.java b/java/org/apache/catalina/core/ApplicationContext.java index cce739b..7e6eed6 100644 --- a/java/org/apache/catalina/core/ApplicationContext.java +++ b/java/org/apache/catalina/core/ApplicationContext.java @@ -454,10 +454,8 @@ public class ApplicationContext implements ServletContext { dispatchData.set(dd); } - MessageBytes uriMB = dd.uriMB; - uriMB.recycle(); - // Use the thread local mapping data + MessageBytes uriMB = dd.uriMB; MappingData mappingData = dd.mappingData; try { @@ -487,7 +485,11 @@ public class ApplicationContext implements ServletContext { } finally { // Recycle thread local data at the end of the request so references // are not held to a completed request as there is potential for - // that to trigger a memory leak if a context is unloaded. + // that to trigger a memory leak if a context is unloaded. Not + // strictly necessary here for uriMB but it needs to be recycled at + // some point so do it here for consistency with mappingData which + // must be recycled here. + uriMB.recycle(); mappingData.recycle(); } } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org