• 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
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

java.lang OutOfMemoryError

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,
I'm getting java.lang.OutOfMemoryError everytime I select more than 50,000 records from mysql database. There is no problem if the result set is less than 50,000. I've already tried increasing the tomcat heap size to maximum but it didn't solve the problem. I'm actually selecting the records from the database using servlet and placing it in a java bean. How can I solve this problem.

Thank you,
rupa
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Select fewer records in one go. What do you need 50000 at the same time for? Its usually very unlikely that you will be able to display 50000 records on a web page (my assumption, since you mention you are using a servlet), so instead select them smaller chuncks.
 
rupambigai permal
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for your suggestion. But the problem is I have to select all those records and output it to one text file. How can I do that? Thank you again.
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My recommendation doesn't change. If you are sure it is the data retrieval which is causing your OutOfMemoryException (and at 50000 records it probably is) retrieve them in smaller chunks and append them to your file.
 
reply
    Bookmark Topic Watch Topic
  • New Topic