• Post Reply Bookmark Topic Watch Topic
  • New Topic

Exception in thread "main" java.lang.OutOfMemoryError: GC overhead limit exceeded  RSS feed

 
berender mavi
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I had a requirement in my project in which i have to provide data in a file to the other application. Data will come through DB on the basis on the basis of date range. I am using SYBASE db. Record count in databse in 8 lacs.

After fetching the data from SYBASE it gets added to List using my organization's internal api. But when i run this process it gives me below error:




If i am not wrong I am getting this error because process is trying to assign 8 lacs objects into the Arraylist.

Can anybody provide alternative ways in which i perform my logic which can run better without going outofmemory.

Thanks,
Manish
 
Dave Tolls
Ranch Hand
Posts: 2835
30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's going to be hard to tell how you can improve this with no code.
First question is, how many rows are you reading from the db into your List?
Do you need to read them all or can you find a way to stream the results?
Looks like you're using the Spring DB stuff, so that's possibly not so easy to achieve.

You seem to be instantiating an expenseCase object (that should be ExpenseCase), which contains a Vehicle, which itself contains a List of something?
Do you need those?
Can you cut down the size of the object you are building?

Of course, the first thing you probably need to do is find out what exactly is taking up the memory...and for that you need a heap dump and some time analysing it.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!