RFR(XS): 8072770: [TESTBUG] Some Introspector tests fail with a Java heap bigger than 4GB

Volker Simonis volker.simonis at gmail.com
Fri Feb 13 09:25:53 UTC 2015


Hi,

can somebody please review this small test fix.

Thanks,
Volker


On Mon, Feb 9, 2015 at 3:27 PM, Volker Simonis <volker.simonis at gmail.com> wrote:
> Hi,
>
> the three Introspector test:
>
> java/beans/Introspector/7064279/Test7064279.java
> java/beans/Introspector/Test7172865.java
> java/beans/Introspector/Test7195106.java
>
> provoke an OutOfMemory situation by repeatedly allocating constantly
> growing arrays with the following loop:
>
> int[] array = new int[1024];
> while (true) {
>   array = new int[array.length << 1];
> }
>
> However if we're running on a machine with plenty of RAM the default
> Java heap will be bigger than ~4GB and we will get a
> NegativeArraySizeException instead of an OutOfMemoryError because the
> array length which is a signed int will wrap around and become
> negative.
>
> The fix is easy - just specify a concrete -Xmx value for the test:
>
> http://cr.openjdk.java.net/~simonis/webrevs/2015/8072770/
> https://bugs.openjdk.java.net/browse/JDK-8072770
>
> Thank you and best regards,
> Volker



More information about the core-libs-dev mailing list