src/hotspot/share/prims/jniCheck.cpp
changeset 48390 fe6fb69336b5
parent 47765 b7c7428eaab9
child 48787 7638bf98a312
--- 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;