Github user srowen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/19460#discussion_r143570916
  
    --- Diff: 
common/unsafe/src/main/java/org/apache/spark/unsafe/array/ByteArrayMethods.java 
---
    @@ -40,6 +40,15 @@ public static int roundNumberOfBytesToNearestWord(int 
numBytes) {
         }
       }
     
    +  // Some JVMs can't allocate arrays of length Integer.MAX_VALUE; actual 
max is somewhat smaller.
    +  // Be conservative and lower the cap a little.
    +  public static int MAX_ARRAY_LENGTH = Integer.MAX_VALUE - 8;
    +
    +  // Use this value if the allocated byte arrays are used to store other 
types rather than bytes.
    +  public static int maxWordRoundedArrayLength() {
    +    return roundNumberOfBytesToNearestWord(MAX_ARRAY_LENGTH - 8);
    --- End diff --
    
    Rounding won't do; it has to round _down_. I see that's why you wrote -8 
here but it's a little confusing as -7 works more directly. And then, why 
bother? just write -15 in the constant above and explain. 


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to