8203885: ConcurrentLocksDump::dump_at_safepoint() should not allocate array in resource area
authorpliden
Tue, 29 May 2018 13:44:44 +0200
changeset 50288 3831655869bc
parent 50287 64c880300d9b
child 50289 0195ee80e530
child 50544 5f20bf95c052
8203885: ConcurrentLocksDump::dump_at_safepoint() should not allocate array in resource area Reviewed-by: dholmes, stuefe, kbarrett
src/hotspot/share/services/threadService.cpp
--- a/src/hotspot/share/services/threadService.cpp	Tue May 29 13:17:03 2018 +0200
+++ b/src/hotspot/share/services/threadService.cpp	Tue May 29 13:44:44 2018 +0200
@@ -675,15 +675,15 @@
   // dump all locked concurrent locks
   assert(SafepointSynchronize::is_at_safepoint(), "all threads are stopped");
 
-  ResourceMark rm;
-
-  GrowableArray<oop>* aos_objects = new GrowableArray<oop>(INITIAL_ARRAY_SIZE);
+  GrowableArray<oop>* aos_objects = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<oop>(INITIAL_ARRAY_SIZE, true /* C_heap */);
 
   // Find all instances of AbstractOwnableSynchronizer
   HeapInspection::find_instances_at_safepoint(SystemDictionary::abstract_ownable_synchronizer_klass(),
                                                 aos_objects);
   // Build a map of thread to its owned AQS locks
   build_map(aos_objects);
+
+  delete aos_objects;
 }