You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Michael McCandless (JIRA)" <ji...@apache.org> on 2014/09/17 00:14:35 UTC

[jira] [Reopened] (LUCENE-5844) ArrayUtil.grow should not pretend you can actually allocate array[Integer.MAX_VALUE]

     [ https://issues.apache.org/jira/browse/LUCENE-5844?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael McCandless reopened LUCENE-5844:
----------------------------------------

Reopen for backport to 4.9.1...

> 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: 4.10, 5.0, 4.9.1
>
>         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.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org