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:53:04 UTC
[tomcat] 01/03: Recycle in a consistent location
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit aea5b946be95c602b7a1812bc0798fc5e9c58dee
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 77f07a2..a95998b 100644
--- a/java/org/apache/catalina/core/ApplicationContext.java
+++ b/java/org/apache/catalina/core/ApplicationContext.java
@@ -473,10 +473,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 {
@@ -505,7 +503,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