--- old/src/hotspot/share/runtime/thread.cpp 2020-02-27 21:52:26.892331800 -0800 +++ new/src/hotspot/share/runtime/thread.cpp 2020-02-27 21:52:26.250306612 -0800 @@ -4342,6 +4342,13 @@ void JavaThread::invoke_shutdown_hooks() { HandleMark hm(this); + // Link all classes for dynamic CDS dumping before vm exit. + // Same operation is being done in JVM_BeforeHalt for handling the + // case where the application calls System.exit(). + if (DynamicDumpSharedSpaces) { + MetaspaceShared::link_and_cleanup_shared_classes(false, this); + } + // We could get here with a pending exception, if so clear it now. if (this->has_pending_exception()) { this->clear_pending_exception();