0

Trying to open a large file (about 128KB) in a java application causes a Map Failed error:

> java.io.IOException: Map failed     at
> uk.ac.starlink.table.QueueTableSequence.nextTable(QueueTableSequence.java:79)
>     at
> uk.ac.starlink.table.StarTableFactory$1.nextTable(StarTableFactory.java:990)
>     at
> uk.ac.starlink.table.gui.TableLoadWorker.run(TableLoadWorker.java:143)
> Caused by: java.io.IOException: Map failed  at
> sun.nio.ch.FileChannelImpl.map(Unknown Source)  at
> uk.ac.starlink.fits.SimpleMappedInput.<init>(SimpleMappedInput.java:41)
>     at
> uk.ac.starlink.fits.InputFactory$2.createInput(InputFactory.java:130)
>     at
> uk.ac.starlink.fits.BintableStarTable$RandomBintableStarTable.<init>(BintableStarTable.java:550)
>     at
> uk.ac.starlink.fits.BintableStarTable.createTable(BintableStarTable.java:399)
>     at
> uk.ac.starlink.fits.FitsTableBuilder.attemptReadTableData(FitsTableBuilder.java:424)
>     at
> uk.ac.starlink.fits.FitsTableBuilder.attemptReadTable(FitsTableBuilder.java:393)
>     at
> uk.ac.starlink.fits.FitsTableBuilder.access$000(FitsTableBuilder.java:46)
>     at
> uk.ac.starlink.fits.FitsTableBuilder$MultiLoadWorker.multiLoad(FitsTableBuilder.java:588)
>     at
> uk.ac.starlink.fits.FitsTableBuilder$MultiLoadWorker.run(FitsTableBuilder.java:567)
> Caused by: java.lang.OutOfMemoryError: Map failed   at
> sun.nio.ch.FileChannelImpl.map0(Native Method)  ... 10 more

I tried searching for an answer on this site, but the only similar cases that I could find were with loading code into frameworks. Take this one, for instance, Java Large File Upload throws java.io.IOException: Map failed. Application that I'm working with is a .jar file (more info here - http://www.star.bris.ac.uk/~mbt/topcat/), and the file I'm trying to load is of .fits type.

Can you please give me some advice concerning this problem? I'm using JRE build 1.8.0_73

Update: The error only seems to appear when I increase maximum heap size. When keeping the default setting everything works fine.

Err403
  • 123
  • 3
  • 10
  • What is the method that you're calling that causes the exception to be raised? Is it possible to simply access the content of the JAR yourself and do what you need to do with it more directly without using this method to open it? It's not an especially large JAR, so there should be no problem in terms of memory. It's going to be whatever the other library is doing that's causing it. https://docs.oracle.com/javase/7/docs/api/java/util/jar/JarFile.html – ManoDestra Mar 04 '16 at 19:27
  • The jar file itself works just fine. I'm having trouble with opening large (128KB and more) fits files with it and since I didn't write the application itself I have no method of accessing it's contents, unless, of course, you have any suggestions. – Err403 Mar 04 '16 at 19:33
  • It would be useful to know which jar you're using, which method you're calling to load the file, etc. – ManoDestra Mar 04 '16 at 19:36
  • I'm using an application called topcat (more info here: http://www.star.bris.ac.uk/~mbt/topcat/) topcat-full.jar version. In the documentation of this application doesn't mention which method is used to load the files. – Err403 Mar 04 '16 at 20:24
  • What method caused your initial issue though? `Trying to open a large file (about 128KB) in a java application causes a Map Failed error` – ManoDestra Mar 04 '16 at 20:27
  • As I said in my updated question, the error only appears when I increase maximum heap size to 1100M, by executing this line in the command prompt: java -Xmx1100M -jar "path to my application" so that must mean that the load method used didn't cause any of this to happen. – Err403 Mar 05 '16 at 11:39

0 Answers0