src/share/vm/memory/compactingPermGenGen.cpp

Print this page

        

@@ -238,13 +238,10 @@
     NOT_PRODUCT(ZapUnusedHeapArea = old_ZapUnusedHeapArea;)
 
     if (_ro_space == NULL || _rw_space == NULL)
       vm_exit_during_initialization("Could not allocate a shared space");
 
-    // Cover both shared spaces entirely with cards.
-    _rs->resize_covered_region(MemRegion(readonly_bottom, readwrite_end));
-
     if (UseSharedSpaces) {
 
       // Map in the regions in the shared file.
       FileMapInfo* mapinfo = FileMapInfo::current_info();
       size_t image_alignment = mapinfo->alignment();

@@ -277,14 +274,18 @@
         delete _rw_bts;
         _rw_bts = NULL;
         delete _rw_space;
         _rw_space = NULL;
         shared_end = (HeapWord*)(rs.base() + rs.size());
-        _rs->resize_covered_region(MemRegion(shared_bottom, shared_bottom));
       }
     }
 
+    if (spec()->enable_shared_spaces()) {
+      // Cover both shared spaces entirely with cards.
+      _rs->resize_covered_region(MemRegion(readonly_bottom, readwrite_end));
+    }
+
     // Reserved region includes shared spaces for oop.is_in_reserved().
     _reserved.set_end(shared_end);
 
   } else {
     _ro_space = NULL;