diff -r 2c3cc4b01880 -r c16ac7a2eba4 src/hotspot/share/jfr/recorder/checkpoint/types/jfrThreadGroup.cpp --- a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrThreadGroup.cpp Wed Oct 30 16:14:56 2019 +0100 +++ b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrThreadGroup.cpp Wed Oct 30 19:43:52 2019 +0100 @@ -25,7 +25,6 @@ #include "precompiled.hpp" #include "jfr/recorder/checkpoint/jfrCheckpointWriter.hpp" #include "jfr/recorder/checkpoint/types/jfrThreadGroup.hpp" -#include "jfr/utilities/jfrResourceManager.hpp" #include "jfr/utilities/jfrTypes.hpp" #include "runtime/handles.inline.hpp" #include "runtime/jniHandles.inline.hpp" @@ -33,6 +32,8 @@ #include "runtime/semaphore.hpp" #include "utilities/growableArray.hpp" +static const int initial_array_size = 30; + class ThreadGroupExclusiveAccess : public StackObj { private: static Semaphore _mutex_semaphore; @@ -257,12 +258,10 @@ } } -JfrThreadGroup::JfrThreadGroup() : _list(NULL) { - _list = new (ResourceObj::C_HEAP, mtTracing) GrowableArray(30, true); -} +JfrThreadGroup::JfrThreadGroup() : + _list(new (ResourceObj::C_HEAP, mtTracing) GrowableArray(initial_array_size, true, mtTracing)) {} JfrThreadGroup::~JfrThreadGroup() { - assert(SafepointSynchronize::is_at_safepoint(), "invariant"); if (_list != NULL) { for (int i = 0; i < _list->length(); i++) { JfrThreadGroupEntry* e = _list->at(i); @@ -281,14 +280,11 @@ } traceid JfrThreadGroup::thread_group_id(const JavaThread* jt, Thread* current) { - ResourceMark rm(current); - HandleMark hm(current); JfrThreadGroupsHelper helper(jt, current); return helper.is_valid() ? thread_group_id_internal(helper) : 0; } traceid JfrThreadGroup::thread_group_id(JavaThread* const jt) { - assert(!JfrStream_lock->owned_by_self(), "holding stream lock but should not hold it here"); return thread_group_id(jt, jt); } @@ -396,9 +392,7 @@ ThreadGroupExclusiveAccess lock; JfrThreadGroup* tg_instance = instance(); assert(tg_instance != NULL, "invariant"); - ResourceManager tg_handle(tg_instance); - set_instance(NULL); - tg_handle->write_thread_group_entries(writer); + tg_instance->write_thread_group_entries(writer); } // for writing a particular thread group