Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

handling OutOfMemoryError  RSS feed

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

i am using jsp to generate excel

if the excel file is large iam getting OutOfMemoryError.

i do not want to increase the heap size.

i want to dump data in excel until i get OutOfMemoryError.

means

if i get error after dumping 30,000 rows. then i want save the file with 29,990 rows.

because of

heap size of jdks are different.


please give solution to this.




 
Ranch Hand
Posts: 820
IntelliJ IDE Tomcat Server VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

gendhe ranjith kumar wrote:hi

i am using jsp to generate excel

if the excel file is large iam getting OutOfMemoryError.

i do not want to increase the heap size.

i want to dump data in excel until i get OutOfMemoryError.

means

if i get error after dumping 30,000 rows. then i want save the file with 29,990 rows.

because of

heap size of jdks are different.


please give solution to this.






one does not handle out of memory error. Not if one wants stable application. Determine how many rows are safe and save that, dividing large files into smaller files.

read what java docs say about it: http://download.oracle.com/javase/6/docs/api/java/lang/Error.html

An Error is a subclass of Throwable that indicates serious problems that a reasonable application should not try to catch. Most such errors are abnormal conditions. The ThreadDeath error, though a "normal" condition, is also a subclass of Error because most applications should not try to catch it.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!