src/hotspot/share/memory/metaspaceShared.cpp
changeset 49332 cd21aff24069
parent 49329 04ed29f9ef33
child 49347 edb65305d3ac
--- a/src/hotspot/share/memory/metaspaceShared.cpp	Fri Mar 02 21:00:12 2018 +0100
+++ b/src/hotspot/share/memory/metaspaceShared.cpp	Fri Mar 02 17:33:59 2018 -0800
@@ -450,6 +450,11 @@
 
 class CollectClassesClosure : public KlassClosure {
   void do_klass(Klass* k) {
+    if (!UseAppCDS && !k->class_loader_data()->is_the_null_class_loader_data()) {
+      // AppCDS is not enabled. Let's omit non-boot classes.
+      return;
+    }
+
     if (!(k->is_instance_klass() && InstanceKlass::cast(k)->is_in_error_state())) {
       if (k->is_instance_klass() && InstanceKlass::cast(k)->signers() != NULL) {
         // Mark any class with signers and don't add to the _global_klass_objects