• Post Reply Bookmark Topic Watch Topic
  • New Topic

OutOfMemoryError  RSS feed

 
San Smith
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am getting for bellow code. Total number of rows result set return 300000. This code works fine with embedded SQL. I just replaced embedded query with stored procedure. I am not sure why I am getting this error. Can anyone please help me?

 
Tim Cooke
Marshal
Posts: 3873
233
Clojure IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're going to need to perform some analysis on your application to find out what you have a lot of on the heap. I'd recommend configuring your JVM to produce a heap dump on OutOfMemoryError, then using something like VisualVM to analyse it.
 
Claude Moore
Ranch Hand
Posts: 894
8
IBM DB2 Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By the way, do you really need to read alla those rows (300000) ? Can't you introduce any pagination?
 
Dave Tolls
Rancher
Posts: 2914
36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That bit of code tells us very little, especially since you do nothing with the row there.

I'll echo the "analyse a heap dump" as well as "do you really need all 300k rows".

I'll add a, what does the actual code look like (execution of the Statement through to the return of the data) for both this version and the original version that apparently handles all 300k rows.
 
subodh kureel
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. Check for JVM setting .You may need big heap size.
2. More code would help..although try below option........

Take DataSet out from while loop .. why do you need to create 300K objects of dataset ?

do it like this instead.

int cnt=0;
DataSet row = null;
while (rs.next()) {
row = new DataSet(columns);
for (int i = 1; i <= numcols; i++) {
row.add(rs.getObject(i));
}
}

Hope this help.

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