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

Hashtable documentation does not specify the maximum value for initialCapacity

    Details

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Picked up _JAVA_OPTIONS:   -Dawt.useSystemAAFontSettings=gasp
      java version "1.8.0_151"
      Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
      Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)

      A DESCRIPTION OF THE PROBLEM :
      Hashtable constructor throws OutOfMemoryError when executing the following program:

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Compile above program
      2. Run it using Oracle HotSpot java

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Hashtable documentation specifying a maximum value for initialCapacity parameter.
      ACTUAL -
      Caused by: java.lang.OutOfMemoryError: Requested array size exceeds VM limit
          at java.util.Hashtable.<init> (Hashtable.java:191)
          at java.util.Hashtable.<init> (Hashtable.java:204)
          at A.main (A.java:4)

      ---------- BEGIN SOURCE ----------
      import java.util.Hashtable;
      public class A {
          public static void main(String[] args) {
              new Hashtable(Integer.MAX_VALUE);
          }
      }
      ---------- END SOURCE ----------

      FREQUENCY : always


        Attachments

          Activity

            People

            • Assignee:
              smarks Stuart Marks
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated: