
|
If you were logged in you would be able to see more operations.
|
|
|
Stripes
Created: 05/Oct/06 06:34 AM
Updated: 05/Oct/06 07:06 PM
|
|
| Component/s: |
None
|
| Affects Version/s: |
None
|
| Fix Version/s: |
Release 1.4.2
|
|
|
The private static Map customValidations in DispatcherHelper is never cleared. Since the key to the map entries are Class objects, when a stripes web application is reloaded, this causes the web application classloader to be pinned in memory and it and all the classes it loaded are never garbage collected.
I found this with version 1.4 of stripes and tomcat 5.5.17. The DispatcherHelper code in 1.4.1 looks the same so I imagine the same problem will happen with this version as well.
As a temporary work around, I placed the following code in the contextDestroyed method of a ContextListener class for my web application:
Field f = DispatcherHelper.class.getDeclaredField("customValidations");
f.setAccessible(true);
Map<Class, Method[]> customValidations = (Map<Class, Method[]>) f.get(DispatcherHelper.class);
customValidations.clear();
It would be nice if stripes exposed a clear method for this field on the DispatcherHelper class so a web app doesn't have to resort this hacked reflection work-around, or better yet, if Stripes had a way to clean it up itself.
|
|
Description
|
The private static Map customValidations in DispatcherHelper is never cleared. Since the key to the map entries are Class objects, when a stripes web application is reloaded, this causes the web application classloader to be pinned in memory and it and all the classes it loaded are never garbage collected.
I found this with version 1.4 of stripes and tomcat 5.5.17. The DispatcherHelper code in 1.4.1 looks the same so I imagine the same problem will happen with this version as well.
As a temporary work around, I placed the following code in the contextDestroyed method of a ContextListener class for my web application:
Field f = DispatcherHelper.class.getDeclaredField("customValidations");
f.setAccessible(true);
Map<Class, Method[]> customValidations = (Map<Class, Method[]>) f.get(DispatcherHelper.class);
customValidations.clear();
It would be nice if stripes exposed a clear method for this field on the DispatcherHelper class so a web app doesn't have to resort this hacked reflection work-around, or better yet, if Stripes had a way to clean it up itself.
|
Show » |
|
|
e.g. map.put(clazz, new WeakReference(methodsArray));