jsf 2.2 - JSF: Mojarra vs. OmniFaces @ViewScoped: @PreDestroy called but bean can't be garbage collected -


this question specific omnifaces @viewscoped bean (however of interest wider discussion memory leakage , resource disposal jsf @viewscoped). based on results of netbeans8.1 test web app available on github:

investigation of undesirable holding of references various forms of jsf @viewscoped beans navigation type

https://github.com/webelcomau/jsfviewscopednav

that test web app has comprehensive readme complete instructions, annotated test web pages comparing obsolete jsf2.0-style @managedbean @viewscoped, jsf2.2-style cdi-friendly @named @viewscoped, , omnifaces @named @viewscoped beans.

the results using jvisualvm diagnosis summarised in downloadable spreadsheet (see screenshot below), , indicate while omnifaces-2.5.1 @viewscoped bean invokes @predestroy methods under get-based navigation cases when leaving view (giving opportunity release resources), not seem permit garbage collection of actual bean (at least not current context parameter settings).

in web.xml application set use:

com.sun.faces.numberofviewsinsession 4  com.sun.faces.numberoflogicalviews 4 

by default omnifaces-specific parameter commented out:

org.omnifaces.view_scope_manager_max_active_view_scopes 

the javax.faces.state_saving_method defaults 'server'.


the main question is:

q1: correct these omnifaces @viewscoped beans can't design garbage collected "live" (meaning through provocation using profiler's garbage collectiong action, not waiting until session over) ?

q2: if so, how can (should) 1 best force release of them on navigating away pages (especially under navigations) ?

q3: if not (if results incorrect because of other setting) why aren't witnessing provoked garbage collection of them, , can ensure indeed automatically released ?

since test web app downloadable, documented , self-explanatory, won't give code here, comparitive results far, screenshots of test web app pages in action:

screenshots of comparitive results

screenshot of home page leading per-bean type test cases

screenshot of jsf2.0-style case

screenshot of jsf2.2-style case

screenshot of omnifaces case

sreenshot of post-navigation target page


Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -