--- a/src/hotspot/share/prims/jniCheck.cpp Tue Dec 12 14:14:06 2017 -0500
+++ b/src/hotspot/share/prims/jniCheck.cpp Tue Dec 12 19:06:19 2017 -0500
@@ -826,7 +826,10 @@
}
jint result = UNCHECKED()->EnsureLocalCapacity(env, capacity);
if (result == JNI_OK) {
- add_planned_handle_capacity(thr->active_handles(), capacity);
+ // increase local ref capacity if needed
+ if ((size_t)capacity > thr->active_handles()->get_planned_capacity()) {
+ add_planned_handle_capacity(thr->active_handles(), capacity);
+ }
}
functionExit(thr);
return result;