Memory leak in the in-process template compiler.
------------------------------------------------

                 Key: RF-8134
                 URL: https://jira.jboss.org/jira/browse/RF-8134
             Project: RichFaces
          Issue Type: Bug
    Affects Versions: 3.3.2.SR1
            Reporter: Alexander Smirnov


In-proces compiled templates are widely used by dynamic stylesheets or 
complonents like suggestionBox. These templates are compiled into in-memory 
object structures what usually have only one instance in application. These 
objects are called with special context to generate request output ( 
lightweight object pattern ).
<f:call element > caches call parameter values in its instance, even 
FacesContext or current component references that are short-time objects. As a 
results, memory leaks are occured in the 
org.ajax4jsf.rendercit.compiler.MethodCallElement class. The source of problem 
are inner Signature1 and Signature2 classes:

Signature1(int size) {
                arguments = new Object[size + 1];
        }
        void update(TemplateContext context, Object[] parameters) {
                arguments[0] = context;
                System.arraycopy(parameters, 0, arguments, 1, 
parameters.length);
        }

}

class Signature2 extends Signature {
        Signature2(int size) {
                arguments = new Object[size + 2];
        }
        void update(TemplateContext context, Object[] parameters) {
                arguments[0] = context.getFacesContext();
                arguments[1] = context.getComponent();
                System.arraycopy(parameters, 0, arguments, 2, 
parameters.length);
        }
To avoid memory leaks, only types of the target method should be cached ( not 
object instances ).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        
_______________________________________________
richfaces-issues mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/richfaces-issues

Reply via email to