Reply To: ViewScoped memory leak

Splash Forums PrettyFaces Users ViewScoped memory leak Reply To: ViewScoped memory leak


I don’t think this has anything to do with PrettyFaces/Rewrite.

How and when view scoped beans are released depends on the how the JSF implementation handles state saving. Typically a JSF implementation keeps a few views (and therefore also the view scope) around for some time because the use may click the back button and then trigger some action on the old page. For MyFaces the number of views saved this way is configurable. There is also an option which allows you to configure how POST-Redirect-GET scenarios are handled in MyFaces.

The h:link component renders a standard HTML link. If you click it, the JSF implementation doesn’t even know that you clicked it. It will just see a request from the browser for the new URL. So this may explain why the view scope is kept alive longer. If you use something like a h:commandButton, JSF knows that it is a postback to the old view. So after navigating away it COULD kill the view scope of the old view.