Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4224797

conversion of big float to int in case expression causes out of memory

XMLWordPrintable

    • generic
    • generic



      Name: dkC59003 Date: 03/29/99



      Javac fails to compile source below ( "constExpr.java" ) with the message about
      exhausting the memory. Similar sample is compiled OK if modified either ways:
       - there are more than one case in switch;
       - float value is not rounded by conversion to int.
      Corresponding lines are commented out in the sample.

      Same effect occurs on all platforms for JDK versions - 1.1.6, 1.2fcs, 1.2.1-L.

      The most important inconvenience is that javac does not generate any message pointing to
      cause of the failure. Windows NT 4.0 shows only system popup "End of virtual memory"
      without pointing to application.

      Similar failure is described in #4157779 (is fixed now).

      --------------------------------------=== javac1.1.6.trace
      ___ java -version
      java version "1.1.6"
      ___ time javac -d . ../constExpr.java
      java.lang.OutOfMemoryError
      at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java)
      at java.io.DataOutputStream.writeInt(DataOutputStream.java)
      at sun.tools.asm.Instruction.write(Instruction.java)
      at sun.tools.asm.Assembler.write(Assembler.java)
      at sun.tools.javac.SourceClass.compileClass(SourceClass.java)
      at sun.tools.javac.SourceClass.compile(SourceClass.java)
      at sun.tools.javac.Main.compile(Main.java)
      at sun.tools.javac.Main.main(Main.java)
      error: An error has occurred in the compiler; please file a bug report (http://java.sun.com/cgi-bin/bugreport.cgi).
      1 error
      28.0u 0.0s 0:44 62% 0+0k 0+0io 0pf+0w
      --------------------------------------=== javac1.2fcs.trace
      ___ java -version
      java version "1.2"
      Classic VM (build JDK-1.2-V, green threads, sunwjit)
      ___ time javac -d . ../constExpr.java
      The compiler has run out of memory. Consider using the "-J-mx<number>" command line option to increase the maximum heap size.
      50.0u 0.0s 2:10 38% 0+0k 0+0io 0pf+0w
      --------------------------------------=== javac1.2.1-L.trace
      ___ java -version
      java version "1.2.1"
      Classic VM (build JDK-1.2.1-L, green threads, sunwjit)
      ___ time javac -d . ../constExpr.java
      The compiler has run out of memory. Consider using the "-J-mx<number>" command line option to increase the maximum heap size.
      51.0u 0.0s 1:37 52% 0+0k 0+0io 0pf+0w

      --- memory used
        PID PPID STIME S VSZ RSS %MEM TT COMMAND
      16055 16033 18:02:45 R 39144 38784 30.6 pts/11 /export/ld25/java/dest/jdk1.2.1L/solaris/bin/../bin/sparc/green_threads/javac -
      ---
      --------------------------------------=== constExpr.java
      class constExpr {

            public static void main(String argv[]) {
               System.out.println("result for Integer.MAX_VALUE : "+ test( Integer.MAX_VALUE ) );
               System.out.println("result for 1 : " + test( 1 ) );
            }
            
            static int test (int I) {
      switch ( I ) {
      case (int)(Integer.MAX_VALUE - 63f) : return 0; // 25 bits :
      // rounded to (float(Integer.MAX_VALUE) + 1)
      // case (int)(Integer.MAX_VALUE - 127f) : return 10; // 24 bits : without rounding
      // case (int)(Integer.MAX_VALUE + 1L) : return 100; //
      default : return -1;
      };
            }

      }
      --------------------------------------===

      ======================================================================

      Name: skT88420 Date: 06/23/99


      C:\IBMVJava\IDE\export>javac PriorityPayPackage01\PriorityPayApp01.java
      java.lang.OutOfMemoryError
              at java.util.Hashtable.rehash(Compiled Code)
              at java.util.Hashtable.put(Compiled Code)
              at sun.tools.asm.ConstantPool.put(Compiled Code)
              at sun.tools.asm.ConstantPool.put(Compiled Code)
              at sun.tools.asm.Instruction.collect(Compiled Code)
              at sun.tools.asm.Assembler.collect(Compiled Code)
              at sun.tools.javac.SourceClass.compileClass(Compiled Code)
              at sun.tools.javac.SourceClass.compile(Compiled Code)
              at sun.tools.javac.Main.compile(Compiled Code)
              at sun.tools.javac.Main.main(Main.java:473)



      C:\IBMVJava\IDE\export>java -version
      java version "1.1.6"

      C:\IBMVJava\IDE\export>java -fullversion
      java full version "JDK1.1.6N"

      error: An error has occurred in the compiler; please file a bug report (http://j
      ava.sun.com/cgi-bin/bugreport.cgi).
      1 error
      (Review ID: 84740)
      ======================================================================

            iris Iris Clark
            dkhukhrosunw Dmitry Khukhro (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: