Java, Programming

JSF RichFaces Session Memory Lack

jsf-richfaces-session-memory-lack

If you using JSF + RichFaces, it may cause Session Memory Lack. AjaxStateHolder saves all views in the session. But the same view can occur several times in this “cache”; the views from this “cache” are not reused and just fill the session. If an application has many large views and deals with many concurrent sessions, the heap can easily grow up to Gigabytes.

Solution – Add below config in web.xml:

<context-param>
    <param-name>com.sun.faces.numberOfViewsInSession</param-name>
    <param-value>1</param-value>
</context-param>
<context-param>
    <param-name>com.sun.faces.numberOfLogicalViews</param-name>
    <param-value>1</param-value>
</context-param>

Set this config to limit JSF view cannot over assigned value.

Tags: ,