mirror of
https://github.com/openjdk/jdk.git
synced 2026-05-09 21:19:38 +00:00
8383772: runtime/reflect/ReflectOutOfMemoryError.java can fail intermittently on Shenandoah with small heaps
Reviewed-by: kdnilsen, wkemper
This commit is contained in:
parent
3ba94aec79
commit
14bdfeb08c
@ -38,7 +38,8 @@ public class ReflectOutOfMemoryError {
|
||||
try {
|
||||
// Repository for objects, which should be allocated:
|
||||
int index = 0;
|
||||
for (int size = 1 << 30; size > 0 && pool == null; size >>= 1)
|
||||
// Halving loop starting from max possible size constrained by max heap size
|
||||
for (int size = (int)(Runtime.getRuntime().maxMemory()>>2); size > 0 && pool == null; size >>= 1)
|
||||
try {
|
||||
pool = new Object[size];
|
||||
} catch (OutOfMemoryError oome) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user