From 8686a36b405fb3bb95f51493c1ef3e470acf2e85 Mon Sep 17 00:00:00 2001 From: Calvin Cheung Date: Tue, 16 May 2023 14:42:33 +0000 Subject: [PATCH] 8307315: Missing ResourceMark in CDS and JVMTI code Reviewed-by: coleenp, iklam --- src/hotspot/share/cds/filemap.hpp | 1 + src/hotspot/share/classfile/klassFactory.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hotspot/share/cds/filemap.hpp b/src/hotspot/share/cds/filemap.hpp index 3428c465b4d..00dd542c52b 100644 --- a/src/hotspot/share/cds/filemap.hpp +++ b/src/hotspot/share/cds/filemap.hpp @@ -487,6 +487,7 @@ public: static void record_non_existent_class_path_entry(const char* path); #if INCLUDE_JVMTI + // Caller needs a ResourceMark because parts of the returned cfs are resource-allocated. static ClassFileStream* open_stream_for_jvmti(InstanceKlass* ik, Handle class_loader, TRAPS); #endif diff --git a/src/hotspot/share/classfile/klassFactory.cpp b/src/hotspot/share/classfile/klassFactory.cpp index 420587dd78c..6f8b4b8238c 100644 --- a/src/hotspot/share/classfile/klassFactory.cpp +++ b/src/hotspot/share/classfile/klassFactory.cpp @@ -54,7 +54,7 @@ InstanceKlass* KlassFactory::check_shared_class_file_load_hook( assert(ik != nullptr, "sanity"); assert(ik->is_shared(), "expecting a shared class"); if (JvmtiExport::should_post_class_file_load_hook()) { - + ResourceMark rm(THREAD); // Post the CFLH JvmtiCachedClassFileData* cached_class_file = nullptr; if (cfs == nullptr) {