Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Out of Memory Exception in Websphere

 
poornima karanth
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
We have a peculiar problem while running a Search Service.
The different components involved are given below:
Struts Controller-> JSP Page -> EJB Stateless Session Bean -> Java Class (DAO)-> Database.
When a user clicks on the 'Search' button, the Search needs to fetch 10,000 records at a time. The request is serviced in the above manner and the resultset is displayed through a JSP Screen. Pagination Logic is built in the query so that it retrieves a partial resultset (ie first 10,000, next 10,000 etc)
However when the user clicks on the 'Next' Button, on the result screen, an Out of Memory Exception is thrown by the Bean. The Heap size is set to maximum. Note there is no SQL Exception occuring, the error occurs when the EJB has to send the resultset to the jsp.
Any Ideas as to why this happens?
 
Raj Chila
Ranch Hand
Posts: 128
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Poornima,
This could be happenning if there is an recursive loop in your logic somewhere...or if there is any cyclic reference between two objects check that. otherwise I dont see any problem...
you dont need to start to fetch the next 10,000 immediately till the traversal of the first 10,000 records are over, and more over may be you need to GC the first 10000 records to fetch the new ones...??
 
poornima karanth
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Rajanikanth,
We did a code check for memory leaks in the code. And found the following.
The Data in each column is huge, (the biggest one is around 500 chars in a column). So while setting the data for this column in every record, the functionality required replacing a particular character by another before display. This was being done in the DAO before populating the ArrayList Object.
We pushed this code to the Query (using Replace function) & now it works fine.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!