• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

java.lang.OutOfMemoryError

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello friends,

I need an urgent assistance with a project that am working on presently at the moment.

I am trying to read and write data in byte arrays from a file with the use of FileInputStream and then write it to another file with the use of FileOutputStream.

My Code works very fine when handling files lesser than 30MB. When i intend to do such with files above 30MB i get a java.lang.OutOfMemoryError exception and the program stops reading and writing.

In order to be able to avoid this error, i then modified the amount of byte that is being read through FileInputStream to 1MB at a time, so that it keeps reading and writing 1MB of data. But i still get the java.lang.OutOfMemoryError exception and the process stops.

I really need to have this project completed asap. Please help rectify the problem. Below is my code:

I anticipate your prompt response guys.

 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As our FAQ says, Available Doesnt Do What You Think It Does. Have you looked at
RandomAccessFile or do you have to use streams?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic