You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@turbine.apache.org by "Thomas Vandahl (JIRA)" <ji...@apache.org> on 2009/01/06 22:01:45 UTC
[jira] Closed: (TRB-70) Memory leak with page auto-refreshing over
several days
[ https://issues.apache.org/jira/browse/TRB-70?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Thomas Vandahl closed TRB-70.
-----------------------------
Fix is in 2.3.3-release
> Memory leak with page auto-refreshing over several days
> -------------------------------------------------------
>
> Key: TRB-70
> URL: https://issues.apache.org/jira/browse/TRB-70
> Project: Turbine
> Issue Type: Bug
> Components: Turbine 2.3
> Affects Versions: Core 2.3.3
> Environment: Linux OS running turbine 2.3.3 & tomcat
> Reporter: Susi Berrington
> Assignee: Thomas Vandahl
> Fix For: Core 2.3.3
>
>
> We have been aware of a memory leak in our system for several years. After other alterations to our code base it finally reached a stage where we could get an OutOfMemoryError in a couple of days.
> So after spending days trying to find a memory leak in our system I finally pinpointed a leak.
> http://svn.apache.org/repos/asf/turbine/core/branches/TURBINE_2_3_BRANCH/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaBaseFactory.java
> This class has a hashmap called classCache which uses className (a StringBuffer) as a key.
> You cannot use StringBuffer as a key in a hashmap as it does not override Object's hashCode() method.
> I attached a debugger and saw the number of items in this map incrementing even though I was returning to a page which was already in the map.
> One potential fix is just to call toString() on className when putting it into the classCache. However as you are only concatenating 5 items className could be changed to a String as follows:
> String className = it.next() + "." + packageName + "." + name;
> This is less code and also removes the need for the toString() method on subsequent uses of the className.
> Patch:
> 85,91c85
> < StringBuffer className = new StringBuffer();
> <
> < className.append(it.next());
> < className.append('.');
> < className.append(packageName);
> < className.append('.');
> < className.append(name);
> ---
> > String className = it.next() + "." + packageName + "." + name;
> 100c94
> < servClass = Class.forName(className.toString());
> ---
> > servClass = Class.forName(className);
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.