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

SEGV in very large arrays of inline classes

XMLWordPrintable

      A segv occurs when accessing element 0 of a very large
      array of inline classes.

      public class BugOpt2 {

          public static void main(String[] args) {
              BNode<Integer, Integer>[] table = new BNode[0x40000000];
              Object k = table[0].key;
              hash(k);
          }

          /**
           * Basic hash bin node.
           */
          static inline class BNode<K,V> {
              final K key;
              final V value;

              BNode(K key, V value) {
                  this.key = key;
                  this.value = value;
              }
          }

          static final int hash(Object key) {
              int h;
              return (key == null) ? 0 : (h = key.hashCode()) ^ (h >>> 16);
          }
      }

        1. BugOpt2.java
          0.6 kB
          Roger Riggs
        2. hs_err_pid20693.log
          86 kB
          Roger Riggs

            dsimms David Simms
            rriggs Roger Riggs
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: