• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Free instances held up by c:forEach tag

 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear All,

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
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What happens if you don't create another reference to the data?
 
Abhijith Prabhakar
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Its the same behavior,
initially i directly assigned using c:forEach tag



I also tried putting <c:remove> outside the loop. Then also references remain
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Same thing without the remove? (Which you don't really need--it's not removing it from the list.)
 
Abhijith Prabhakar
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes, remove really doesn't help. Same behavior continues
 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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?
 
Abhijith Prabhakar
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We use apache taglibs



Application is hosted on Tomcat 5.5.25
 
Kris Schneider
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Kris Schneider
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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 .
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mmm, tag pooling. Forgot about that; had an issue with that on Resin back in the day--very similar issue.
 
Put a gun against his head, pulled my trigger, now he's dead, that tiny ad sure bled
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic