OutofMemory Error When running Java NIO with JDK 1.4.2_01
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Martin_Wilkes
Posted On:   Thursday, November 6, 2003 03:09 PM

Now I get a "java.lang.OutOfMemoryError" when trying to scan a 68,612 KB file, using memory-mapped feature of Java NIO. The code looks like: // Open a channel and memory map the file try { fis = new FileInputStream(aFile); fc = fis.getChannel(); size = (int) fc.size(); bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, size); cb = decoder.decode(bb); } catch(IOException e) { e.printStackTrace(System.err); } Any suggestions? Should I go back to older technology? ...maybe try JFlex? Thanks for any help - M    More>>

Now I get a "java.lang.OutOfMemoryError" when trying to scan a 68,612 KB file, using memory-mapped feature of Java NIO. The code looks like:


			
// Open a channel and memory map the file
try {
fis = new FileInputStream(aFile);
fc = fis.getChannel();
size = (int) fc.size();
bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, size);
cb = decoder.decode(bb);
}
catch(IOException e) {
e.printStackTrace(System.err);
}


Any suggestions? Should I go back to older technology?
...maybe try JFlex?
Thanks for any help - M

   <<Less

Re: OutofMemory Error When running Java NIO with JDK 1.4.2_01

Posted By:   Steven_Martin  
Posted On:   Thursday, November 6, 2003 06:55 PM

The jvm default memory is 64 meg



Run java as java -Xmx256m



You should also consider a more memory efficenct method.
About | Sitemap | Contact