Win a copy of Rust Web Development this week in the Other Languages 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 ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Exception in thread "main" java.lang.OutOfMemoryError

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hai

I have to insert around 80 lacs of rows in to the table,while inserting suddenly i got this exception ----->Exception in thread "main" java.lang.OutOfMemoryError<--------

i increased the heap size to 1024m, but same problem is coming

is there any alternative to solve this problem or any other solutions
 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe you should fixed/recheck your algorithm.

For example:
If you want to insert 80 lacs ( I do not get what lacs is ), used some buffer strategy. In case, put you 10 lacs in a List, save, then clear the list ( list.clear() ) to put next 10 lacs. Do it repeatedly until 80 lacs.
 
Marshal
Posts: 74687
335
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would expect 80 crore to overwhelm your memory, but not 80 lakh.
Have you got some sort of recursion which doesn't terminate?
[ April 25, 2008: Message edited by: Campbell Ritchie ]
 
Campbell Ritchie
Marshal
Posts: 74687
335
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually, how long is each line?
80 lakh * 100 Bytes is about 800MB so even 80 lakh might overwhelm your resources.
What sort of table are you inserting into? A database? Are you using anything which maintains the lines in memory after you have inserted them? If you are inserting into a database, is there any delay in the database? Can you put a tiny delay between successive lines? Can you split the process so as to insert 1 line at a time?

And lakh (also spelt lac) = 100000
 
I didn't like the taste of tongue and it didn't like the taste of me. I will now try this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic