0

We are having a high memory consumption on our app, we took a heap dump and mat analyzer is pointing two leak suspects. enter image description here

The first one is "org.apache.catalina.session.StandardManager", so if we dig in we found that on every session JSF saves on the activeViewMap 23 views approx. and some of these views are retaining 23MB.

The second leak suspect is 201 instances of "org.apache.tomcat.util.threads.TaskThread" that are retaining 1GB of memory, on each of these most of the objects are jsf components.

enter image description here

Also when this heap dump was taken, the GC executed for a long time: enter image description here

  • Is it normal that JSF is consuming that much memory? How can I reduce memory consumption?
  • I'm using a lot of custom tags and a lot of EL conditional expressions in these, could this be a problem?
  • Is it a good idea to reduce active views to the minimum? I already tried setting com.sun.faces.numberOfLogicalViews and com.sun.faces.numberOfViewsInSession to 6 instead of the default 15
  • Which is the correct way to use viewscoped beans? Is it correct to use for a datatable of results or should I use requestscoped?
dssof
  • 117
  • 6
  • It's not normal that JSF components end up in long term memory no. A common starter's mistake is using `binding` attribute to reference a JSF component as a property of a bean which is not in the request scope (that single component in turn basically references the entire component tree). Have you already excluded it from being the cause? See also https://stackoverflow.com/q/14911158 – BalusC Nov 14 '21 at 10:23
  • @BalusC yes, I removed binding attributes already. ¿What could be the cause of this? ¿Can custom tags be a problem? – dssof Nov 14 '21 at 12:04
  • @BalusC do you know any possible cause/solution to this? – dssof Nov 21 '21 at 21:01
  • Referencing a JSF component as a property of a bean which is not in the request scope. – BalusC Nov 22 '21 at 13:22
  • @BalusC I use viewscoped for the most part, I guess some beans can be replaced with request scope but others can't. Are you saying that I shouldnt use view scoped at all? or just some sepecific components? – dssof Nov 23 '21 at 17:09
  • @dssof, have you found any solution yet? My project has the same problem – Asgar Jun 05 '23 at 16:50
  • Sorry, I haven't found a solution yet. BalusC's recommendations were not helpful, and there isn't much information on JSF because it's basically a dead technology – dssof Jun 05 '23 at 18:47

0 Answers0