@@ -206,7 +206,9 @@ oop HeapShared::archive_heap_object(oop obj, Thread* THREAD) {
206
206
log_error (cds, heap)(
207
207
" Cannot allocate space for object " PTR_FORMAT " in archived heap region" ,
208
208
p2i (obj));
209
- vm_exit (1 );
209
+ vm_direct_exit (-1 ,
210
+ err_msg (" Out of memory. Please run with a larger Java heap, current MaxHeapSize = "
211
+ SIZE_FORMAT " M" , MaxHeapSize/M));
210
212
}
211
213
return archived_oop;
212
214
}
@@ -725,7 +727,7 @@ oop HeapShared::archive_reachable_objects_from(int level,
725
727
// these objects that are referenced (directly or indirectly) by static fields.
726
728
ResourceMark rm;
727
729
log_error (cds, heap)(" Cannot archive object of class %s" , orig_obj->klass ()->external_name ());
728
- vm_exit (1 );
730
+ vm_direct_exit (1 );
729
731
}
730
732
731
733
// java.lang.Class instances cannot be included in an archived object sub-graph. We only support
@@ -735,7 +737,7 @@ oop HeapShared::archive_reachable_objects_from(int level,
735
737
// object that is referenced (directly or indirectly) by static fields.
736
738
if (java_lang_Class::is_instance (orig_obj)) {
737
739
log_error (cds, heap)(" (%d) Unknown java.lang.Class object is in the archived sub-graph" , level);
738
- vm_exit (1 );
740
+ vm_direct_exit (1 );
739
741
}
740
742
741
743
oop archived_obj = find_archived_heap_object (orig_obj);
@@ -771,7 +773,7 @@ oop HeapShared::archive_reachable_objects_from(int level,
771
773
// We don't know how to handle an object that has been archived, but some of its reachable
772
774
// objects cannot be archived. Bail out for now. We might need to fix this in the future if
773
775
// we have a real use case.
774
- vm_exit (1 );
776
+ vm_direct_exit (1 );
775
777
}
776
778
}
777
779
@@ -1031,7 +1033,7 @@ void HeapShared::init_subgraph_entry_fields(ArchivableStaticFieldInfo fields[],
1031
1033
ArchiveUtils::check_for_oom (PENDING_EXCEPTION); // exit on OOM
1032
1034
log_info (cds)(" %s: %s" , PENDING_EXCEPTION->klass ()->external_name (),
1033
1035
java_lang_String::as_utf8_string (java_lang_Throwable::message (PENDING_EXCEPTION)));
1034
- vm_exit_during_initialization ( " VM exits due to exception, use -Xlog:cds,exceptions=trace for detail" );
1036
+ vm_direct_exit (- 1 , " VM exits due to exception, use -Xlog:cds,exceptions=trace for detail" );
1035
1037
}
1036
1038
InstanceKlass* ik = InstanceKlass::cast (k);
1037
1039
assert (InstanceKlass::cast (ik)->is_shared_boot_class (),
0 commit comments