2

Each time, I go on a specific jsf page which bean is annotated with @ViewScoped, the heap increase.

How to destroy ViewScope context ? (to destroy all associated objects and clean memory heap) Upgrading to 2.2.8 give me other errors, so i want to stay with jsf 2.2.6 implementation.

Question is relative to this : "ViewScope context is not destroyed when View Map is destroyed"

So what is the other method to achieve this ? Does it mean ViewScoped have a pegleg and that is not recommended to use it. So what is the alternative when you have a lot info to display and also ajax on the same page ?

I tried this solution too without sucess. (this post looks like the same) I read that and also that , i have tried @PreDestroy annotation who doesn't work either in ViewScoped.

I don't want to increase too much memory heap of VM. If i go on the same jsf page handled by a managed bean with a viewScoped, each time the memory increase until application crash.

Garbage Collector is not occuring during session even after multi-postback or if i close definitively the session and wait 5-10 minutes.

NB: @PreDestroy is still called when session is closed.

Community
  • 1
  • 1
ZheFrench
  • 1,164
  • 3
  • 22
  • 46
  • I'm aware about the fact GC works when it is needed and not just after object dereference. I test under default VM parameters and yes it was craching during the week. But sometimes the GC works, when the heap is too high, but still get increased I swear and so at some point, it crashes and i don't know why. I set heap to -Xms2048m -Xmx2048m to avoid problem and I sometimes use GC via VisualVM to release memory. I panic because i'd like to understand how it works. I'm not putting on trial JSF applications in production all over the world :) Just like to understand why it's greedy in memory – ZheFrench Oct 15 '14 at 16:53
  • When there is so many layers it comes hard to debug. The application (and the session logging) is handled by Spring Security. I don't understand well how jsf and spring interact together but it's maybe related. Just one last question, if as it is said on JAVASERVERFACES-3194 "ViewScope context is not destroyed when View Map is destroyed". Is there an another way to clean up the maximum of things to test memory behavior even it makes my session stop? Thanks for you comment. – ZheFrench Oct 15 '14 at 17:35
  • http://stackoverflow.com/questions/12182844/memory-leak-with-viewscoped-bean - have look into it........ http://forum.primefaces.org/viewtopic.php?f=3&t=27344 – Sureshkumar Panneerselvan Dec 28 '14 at 06:22
  • have you found any solution for jsf 2.2? we are experiencing memory leaks with custom viewscope in spring as well. – fischermatte Aug 04 '15 at 13:38
  • nope :/ I increased heapSize memory. Triyng to upgrade JSF as well could be a good idea.(i hope they correct that) I'm no more working on this project so hard to answer now.Good luck – ZheFrench Aug 05 '15 at 14:59

0 Answers0