[
https://issues.apache.org/jira/browse/LUCENE-5844?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14072998#comment-14072998
]
Michael McCandless commented on LUCENE-5844:
--------------------------------------------
bq. Couldn't this be somehow linked up to array header overhead in RUE?
+1, the comment in ArrayList.java (OpenJDK 7) is:
{quote}
190 /**
191 * The maximum size of array to allocate.
192 * Some VMs reserve some header words in an array.
193 * Attempts to allocate larger arrays may result in
194 * OutOfMemoryError: Requested array size exceeds VM limit
195 */
196 private static final int MAX_ARRAY_SIZE = Integer.MAX_VALUE - 8;
{quote}
So we could just change the 8 to RUE.NUM_BYTES_ARRAY_HEADER? Or maybe we can
sneak in and try to access this private MAX_ARRAY_SIZE...?
> ArrayUtil.grow should not pretend you can actually allocate
> array[Integer.MAX_VALUE]
> ------------------------------------------------------------------------------------
>
> Key: LUCENE-5844
> URL: https://issues.apache.org/jira/browse/LUCENE-5844
> Project: Lucene - Core
> Issue Type: Bug
> Components: core/other
> Reporter: Michael McCandless
> Assignee: Michael McCandless
> Fix For: 5.0, 4.10
>
> Attachments: LUCENE-5844.patch, LUCENE-5844.patch
>
>
> Today if the growth it wants would exceed Integer.MAX_VALUE, it returns
> Integer.MAX_VALUE, but you can't actually allocate arrays this large; the
> actual limit is JVM dependent and varies across JVMs ...
> It would be nice if we could somehow "introspect" the JVM to find out what
> its actual limit is and use that.
> http://stackoverflow.com/questions/3038392/do-java-arrays-have-a-maximum-size
> seems to imply that using Integer.MAX_VALUE - 8 may be "safe" (it's what
> ArrayList.java apparently uses).
--
This message was sent by Atlassian JIRA
(v6.2#6252)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]