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) {