ASF Bugzilla – Attachment 19291 Details for
Bug 37956
Make 'set static fields to null' ClassLoader leak workaround behaviour configurable
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Flag for toggling memory leak workaround
patch.txt (text/plain), 4.94 KB, created by
Steffen Dienst
on 2006-12-20 02:09:35 UTC
(
hide
)
Description:
Flag for toggling memory leak workaround
Filename:
MIME Type:
Creator:
Steffen Dienst
Created:
2006-12-20 02:09:35 UTC
Size:
4.94 KB
patch
obsolete
>Index: .classpath >=================================================================== >--- .classpath (revision 488761) >+++ .classpath (working copy) >@@ -12,7 +12,7 @@ > <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> > <classpathentry kind="var" path="ANT_HOME/lib/ant.jar"/> > <classpathentry kind="var" path="TOMCAT_LIBS_BASE/commons-logging-1.0.4/commons-logging-api.jar"/> >- <classpathentry kind="var" path="TOMCAT_LIBS_BASE/commons-modeler-1.1/commons-modeler.jar"/> >+ <classpathentry kind="var" path="TOMCAT_LIBS_BASE/commons-modeler-2.0/commons-modeler-2.0.jar"/> > <classpathentry kind="var" path="TOMCAT_LIBS_BASE/mx4j-3.0.1/lib/mx4j.jar"/> > <classpathentry kind="var" path="TOMCAT_LIBS_BASE/commons-launcher-0.9/bin/commons-launcher.jar"/> > <classpathentry kind="var" path="TOMCAT_LIBS_BASE/struts-1.2.7/lib/antlr.jar"/> >Index: catalina/src/share/org/apache/catalina/core/StandardContext.java >=================================================================== >--- catalina/src/share/org/apache/catalina/core/StandardContext.java (revision 488761) >+++ catalina/src/share/org/apache/catalina/core/StandardContext.java (working copy) >@@ -178,7 +178,10 @@ > */ > private boolean antiJARLocking = false; > >- >+ /** >+ * The nullifyReferences flag for this Context. >+ */ >+ private boolean nullifyReferences = true; > /** > * The antiResourceLocking flag for this Context. > */ >@@ -875,7 +878,23 @@ > return (this.antiResourceLocking); > > } >+ /** >+ * @param flag The nullInstanceFields to set. >+ */ >+ public void setNullifyReferences(boolean flag) { >+ boolean oldNullInstanceFields = this.nullifyReferences; >+ this.nullifyReferences = flag; >+ support.firePropertyChange("nullifyReferences", >+ new Boolean(oldNullInstanceFields), >+ new Boolean(this.nullifyReferences)); >+ } > >+ /** >+ * @return Returns the nullInstanceFields. >+ */ >+ public boolean getNullifyReferences() { >+ return nullifyReferences; >+ } > > /** > * Set the antiJARLocking feature for this Context. >Index: catalina/src/share/org/apache/catalina/loader/WebappLoader.java >=================================================================== >--- catalina/src/share/org/apache/catalina/loader/WebappLoader.java (revision 488761) >+++ catalina/src/share/org/apache/catalina/loader/WebappLoader.java (working copy) >@@ -667,9 +667,10 @@ > classLoader = createClassLoader(); > classLoader.setResources(container.getResources()); > classLoader.setDelegate(this.delegate); >- if (container instanceof StandardContext) >+ if (container instanceof StandardContext){ > classLoader.setAntiJARLocking(((StandardContext) container).getAntiJARLocking()); >- >+ classLoader.setNullifyReferences(((StandardContext) container).getNullifyReferences()); >+ } > for (int i = 0; i < repositories.length; i++) { > classLoader.addRepository(repositories[i]); > } >Index: catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java >=================================================================== >--- catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java (revision 488761) >+++ catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java (working copy) >@@ -168,6 +168,11 @@ > */ > boolean antiJARLocking = false; > >+ /** >+ * Set static fields of loaded classes to null when undeploying to prevent >+ * memory leaks. >+ */ >+ boolean nullifyReferences = true; > > // ----------------------------------------------------------- Constructors > >@@ -424,15 +429,29 @@ > return antiJARLocking; > } > >- >- /** >+ /** > * @param antiJARLocking The antiJARLocking to set. > */ > public void setAntiJARLocking(boolean antiJARLocking) { > this.antiJARLocking = antiJARLocking; > } >+ >+ /** >+ * @param flag The nullifyReferences to set. >+ */ >+ public void setNullifyReferences(boolean flag) { >+ this.nullifyReferences = flag; >+ } > >+ /** >+ * @return Returns the nullifyReferences. >+ */ >+ public boolean getNullifyReferences() { >+ return nullifyReferences; >+ } > >+ >+ > /** > * If there is a Java SecurityManager create a read FilePermission > * or JndiPermission for the file directory path. >@@ -1587,6 +1606,7 @@ > } > } > >+ if(nullifyReferences) { > // Null out any static or final fields from loaded classes, > // as a workaround for apparent garbage collection bugs > Iterator loadedClasses = ((HashMap) resourceEntries.clone()).values().iterator(); >@@ -1633,7 +1653,7 @@ > } > } > } >- >+ } > // Remove entries for this webapp from the JSP EL BeanInfo cache > cleanElCache(); >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 37956
: 19291