Our application in production started throwing outofmemory error recently. I used JProbe profiler to narrow down lottering objects.
I found that there is an arraylist which in turn holds many DTO objects is not getting released. I create this arraylist in view bean and loop it through in jsp using c:forEach tag. I found from profiler that c:forEach tag is holding live references hence this object is not getting garbage collected. I confirmed it by removing c:forEach tag and putting scriplets instead. The instances are getting garbage collected perfectly when used with scriplets!!
I tried removing the variables using c:remove tag. But didn't help. Please find below the piece of code.
Can someone please suggest me how can I make this "attribute" variable reference to null? Really don't want to use scriplet since it will be a step back.
Thanks in advance
Abhijith Prabhakar wrote:Can someone please suggest me how can I make this "attribute" variable reference to null?
If you're using the Apache Standard Taglib, here's some background on the issue: Bug 33934
Unfortunately, we haven't really addressed it yet. You may want to investigate whether or not disabling tag pooling is of any help (although this may also introduce other performance and/or GC behavior issues).
Which app server are you using and what version of JSP does it support?
Application is hosted on Tomcat 5.5.25
Abhijith Prabhakar wrote:Application is hosted on Tomcat 5.5.25
If you want to try disabling tag pooling, review the Jasper How To documentation. In the Configuration section, you'll find a reference to the enablePooling param.
Abhijith Prabhakar wrote:Yes instances got released after disabling tag pooing.
Does the application performance go down if I disable tag pooling? Can you please let me know the impact of this?
I'm not trying to avoid giving an answer, but it really depends on your application and the conditions under which it is being run. It sounds like you've got a pretty good handle on profiling already, so I'd suggest that you run some tests and see what happens. You never know, it might even improve .