Menu

#65 Out of heap space while loading main class

open
nobody
7
2011-10-13
2011-10-13
RTroy
No

$ java -jar setup.jar
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Unknown Source)
at java.io.ByteArrayOutputStream.toByteArray(Unknown Source)
at com.simontuffs.onejar.JarClassLoader$ByteCode.<init>(JarClassLoader.java:153)
at com.simontuffs.onejar.JarClassLoader.loadBytes(JarClassLoader.java:612)
at com.simontuffs.onejar.JarClassLoader.loadByteCode(JarClassLoader.java:542)
at com.simontuffs.onejar.JarClassLoader.load(JarClassLoader.java:452)
at com.simontuffs.onejar.JarClassLoader.load(JarClassLoader.java:338)
at com.simontuffs.onejar.Boot.run(Boot.java:324)
at com.simontuffs.onejar.Boot.main(Boot.java:168)

$ java -version
java version "1.6.0_20"
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Java HotSpot(TM) Client VM (build 16.3-b01, mixed mode, sharing)

Using One-JAR 0.97 downloaded as of the date of this bug report. (one-jar-boot-0.97.jar)

The deployment system has 8 gigabytes of main memory (using about 5.8G at the time) and is running Windows XP Corporate Edition under a dual-quad CPU configuration (8 concurrently running CPU threads / processes). NO arguments were passed to the JVM - it's all "the default".

The deployed jar is 110 megabytes, but the main class consists of only one class file (setup.class). The supporting classes provided in the deployment jar are significant in number but most are not used by the setup class - several different JDBC drivers are included in the deployment but only one will be used at run-time; I suspect it is the total number of classes / class files that gets it in trouble as it has to all fit into memory, I suppose. In the normal deployment mode (non-One-Jar), there are zero issues of this kind and I suspect it's because the normal strategy can leave the material on disk until needed while One Jar needs to read it all in - but that's PURE speculation on my part, of course - just trying to be helpful.

Discussion

  • RTroy

    RTroy - 2011-10-13
    • priority: 5 --> 7
     
  • RTroy

    RTroy - 2011-10-13

    I just increased the priority - to me, this is the highest priority because I can't use One-Jar when it does something like this, but then, at the moment, I'm not dependent upon it for deployment as this deployment strategy is new for this application.

     

Log in to post a comment.