RFR [8043476] java/util/BitSet/BSMethods.java failed with: java.lang.OutOfMemoryError: Java heap space

Ivan Gerasimov ivan.gerasimov at oracle.com
Sun May 25 06:43:02 UTC 2014


Hello!

There was a bug in BitSet.toString() fixed with JDK-8040806.
Unfortunately, the test that had come with this change started to fail 
with OOM.
This is because it needs to create a BitSet with the bit 
Integer.MAX_VALUE set, so this BitSet occupies 256M.
In particular, the test fails on 32-bit platforms.

The proposed fix for this is: First, run in othervm mode, so we're sure 
that no other tests consume the heap space.
And second, explicitly check that VM is able to allocate enough memory.
Experiments showed that 380M seem to be the needed minimum, so I set the 
boundary to 512M.

I've checked the updated test with JPRT on all available platforms, no 
failures.

Would you please review the fix?

BUGURL: https://bugs.openjdk.java.net/browse/JDK-8043476
WEBREV: http://cr.openjdk.java.net/~igerasim/8043476/0/webrev/

Sincerely yours,
Ivan




More information about the core-libs-dev mailing list