This week's giveaway is in the Spring forum.
We're giving away four copies of Microservices Testing (Live Project) and have Chris Love & Andres Sacco on-line!
See this thread for details.
Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • 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 ...
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

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

Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.

Posts: 4801
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
    Bookmark Topic Watch Topic
  • New Topic