• Post Reply Bookmark Topic Watch Topic
  • New Topic

Reading 600 mb size text file

 
Prachi Gupta
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am getting java heap space error while reading 600 mb text file. Actually I have to process each line and add the data to xml object. Due to this the size of object is dynamically growing. ANd giving heap space problem. I am using BufferedReader. Can any one please suggest some ideas?

Thanks
 
Joe Ess
Bartender
Posts: 9361
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch.
You have two choices: increase the Java heap size (see the -Xmx argument here) or figure out some way to split up the data you are working with into smaller chunks.
 
Prachi Gupta
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you.

I have tried increasing the heap size. It dint work. I am not getting how should I divide the files in chunks of data.
 
Joe Ess
Bartender
Posts: 9361
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know what you are doing, so it's hard for me to give you exact instructions (and even if I did know, I'd tell you to do your own work).
In general, rather than trying to read in all the data and manipulate the XML in-memory, try to read in one line of input and write out one "record" of XML.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!