• Post Reply Bookmark Topic Watch Topic
  • New Topic

Out of memory error while writing to a file  RSS feed

 
RamaSarma Vemuri
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am getting an out of memory error while writing the contents from a text file to another. The scenario is, the input file will have several columns and the output file consists some of the columns info from i/p file. There are about 1000000 records in the i/p file. When I am trying to write to the o/p file record by record, its throwing an out of memory exception. Can somebody help me out in this.

Regards,
Ram
 
Joe Ess
Bartender
Posts: 9436
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You must be accumulating data somewhere. Are you putting records into some Collection like an ArrayList? Can you show us a small piece of code that exhibits this behavior?
 
aslam parveez
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you have a big file (as it is in your case) u canot read/write it into the existing i/o streams. All you have to do is break it into chunks of bytes and then read/write whatever..
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!