--- a/hotspot/src/share/vm/runtime/jniHandles.cpp Wed Jun 11 09:58:23 2014 -0400
+++ b/hotspot/src/share/vm/runtime/jniHandles.cpp Wed Jun 11 18:34:09 2014 +0200
@@ -298,6 +298,7 @@
block->_top = 0;
block->_next = NULL;
block->_pop_frame_link = NULL;
+ block->_planned_capacity = block_size_in_oops;
// _last, _free_list & _allocate_before_rebuild initialized in allocate_handle
debug_only(block->_last = NULL);
debug_only(block->_free_list = NULL);
@@ -531,6 +532,12 @@
return result;
}
+const size_t JNIHandleBlock::get_number_of_live_handles() {
+ CountHandleClosure counter;
+ oops_do(&counter);
+ return counter.count();
+}
+
// This method is not thread-safe, i.e., must be called while holding a lock on the
// structure.
long JNIHandleBlock::memory_usage() const {