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

the max of heap size can not reach 2,147,483,647 bytes ( 2**31 -1 )

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.3.0, 1.4.0
    • hotspot
    • x86
    • windows_nt, windows_2000

      Name: skT88420 Date: 12/10/99


      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-I)
      Java HotSpot(TM) Client VM (build 1.3-I, mixed mode)

      In SDK v1.3 RA , the max of heap size can reach only 1262485504 bytes.
      It is much smaller than 2,147,483,647 bytes ( 2**31 -1 ).

      G:\java\test>java -mx2147483647 LargeArrayTest6
      Error occurred during initialization of VM
      Size of maximum heap (-2147483648 bytes) must be aligned to 2097152 bytes

      G:\java\test>java -mx1262485505 LargeArrayTest6
      Error occurred during initialization of VM
      Could not reserve enough space for object heap

      G:\java\test>java -mx1262485504 LargeArrayTest6
      1262485504
      Exception in thread "main" java.lang.OutOfMemoryError
              <<no stack trace available>>
      ----------------------------------------------------------------------
      But in IBM JDK 1.1.8
      The max Heap size can reach 2,147,483,647 bytes ( 2**31 -1 ).

      [F:\java\test]java -mx2147483647 LargeArrayTest6
      2146914612
      should be 123: 123

      //================================================
      class LargeArrayTest6 {
        public static void main(String[] args) {
          byte[] array;
          int size = 1259761470; <<-- modify the size here
          System.out.println( size );

          array = new byte[size];
          array[size-1] = 123;
          System.out.println("should be 123: " + array[size-1]);

        }
      }
      //================================================
      (Review ID: 98874)
      ======================================================================

            jloizeausunw Jane Loizeaux (Inactive)
            skonchad Sandeep Konchady
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: