Integer.MAX_VALUE is too large for arrays

Issue #61 new
dmoos
created an issue

For example in the TPrimitiveHash class the _states variable is a byte array where the capacity is determined as prime number via a call to PrimeFinder.nextPrime(). This method returns as largest prime number Integer.MAX_VALUE, but creating an array of this size results in a "java.lang.OutOfMemoryError: Requested array size exceeds VM limit" exception, as the largest supported array size is Integer.MAX_VALUE - 8.

I ran into this problem, when I tried to store about 1 billion elements in a HashSet with a loadFactor of 0.5.

Comments (1)

  1. Log in to comment