You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2020/05/04 14:43:12 UTC
[tomcat] 01/02: Recycle in a consistent location
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 39f7d5bc47076a7723b14b26b99ee921ceb3c603
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 ce8e718..61981e5 100644
--- a/java/org/apache/catalina/core/ApplicationContext.java
+++ b/java/org/apache/catalina/core/ApplicationContext.java
@@ -439,10 +439,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 {
@@ -472,7 +470,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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org