738
739 if (_verbose && Exceptions::has_exception_counts()) {
740 st->print_cr("OutOfMemory and StackOverflow Exception counts:");
741 Exceptions::print_exception_counts_on_error(st);
742 st->cr();
743 }
744
745 STEP("printing compressed oops mode")
746
747 if (_verbose && UseCompressedOops) {
748 Universe::print_compressed_oops_mode(st);
749 if (UseCompressedClassPointers) {
750 Metaspace::print_compressed_class_space(st);
751 }
752 st->cr();
753 }
754
755 STEP("printing heap information")
756
757 if (_verbose && Universe::is_fully_initialized()) {
758 Universe::heap()->print_on_error(st);
759 st->cr();
760 st->print_cr("Polling page: " INTPTR_FORMAT, p2i(os::get_polling_page()));
761 st->cr();
762 }
763
764 STEP("printing code cache information")
765
766 if (_verbose && Universe::is_fully_initialized()) {
767 // print code cache information before vm abort
768 CodeCache::print_summary(st);
769 st->cr();
770 }
771
772 STEP("printing ring buffers")
773
774 if (_verbose) {
775 Events::print_all(st);
776 st->cr();
777 }
778
915 if (Exceptions::has_exception_counts()) {
916 st->print_cr("OutOfMemory and StackOverflow Exception counts:");
917 Exceptions::print_exception_counts_on_error(st);
918 st->cr();
919 }
920
921 // STEP("printing compressed oops mode")
922
923 if (UseCompressedOops) {
924 Universe::print_compressed_oops_mode(st);
925 if (UseCompressedClassPointers) {
926 Metaspace::print_compressed_class_space(st);
927 }
928 st->cr();
929 }
930
931 // STEP("printing heap information")
932
933 if (Universe::is_fully_initialized()) {
934 MutexLocker hl(Heap_lock);
935 Universe::heap()->print_on_error(st);
936 st->cr();
937 st->print_cr("Polling page: " INTPTR_FORMAT, p2i(os::get_polling_page()));
938 st->cr();
939 }
940
941 // STEP("printing code cache information")
942
943 if (Universe::is_fully_initialized()) {
944 // print code cache information before vm abort
945 CodeCache::print_summary(st);
946 st->cr();
947 }
948
949 // STEP("printing ring buffers")
950
951 Events::print_all(st);
952 st->cr();
953
954 // STEP("printing dynamic libraries")
955
1369 * ensures utilities such as jmap can observe the process is a consistent state.
1370 */
1371 class VM_ReportJavaOutOfMemory : public VM_Operation {
1372 private:
1373 const char* _message;
1374 public:
1375 VM_ReportJavaOutOfMemory(const char* message) { _message = message; }
1376 VMOp_Type type() const { return VMOp_ReportJavaOutOfMemory; }
1377 void doit();
1378 };
1379
1380 void VM_ReportJavaOutOfMemory::doit() {
1381 // Don't allocate large buffer on stack
1382 static char buffer[O_BUFLEN];
1383
1384 tty->print_cr("#");
1385 tty->print_cr("# java.lang.OutOfMemoryError: %s", _message);
1386 tty->print_cr("# -XX:OnOutOfMemoryError=\"%s\"", OnOutOfMemoryError);
1387
1388 // make heap parsability
1389 Universe::heap()->ensure_parsability(false); // no need to retire TLABs
1390
1391 char* cmd;
1392 const char* ptr = OnOutOfMemoryError;
1393 while ((cmd = next_OnError_command(buffer, sizeof(buffer), &ptr)) != NULL){
1394 tty->print("# Executing ");
1395 #if defined(LINUX)
1396 tty->print ("/bin/sh -c ");
1397 #elif defined(SOLARIS)
1398 tty->print ("/usr/bin/sh -c ");
1399 #endif
1400 tty->print_cr("\"%s\"...", cmd);
1401
1402 if (os::fork_and_exec(cmd) < 0) {
1403 tty->print_cr("os::fork_and_exec failed: %s (%s=%d)",
1404 os::strerror(errno), os::errno_name(errno), errno);
1405 }
1406 }
1407 }
1408
1409 void VMError::report_java_out_of_memory(const char* message) {
|
738
739 if (_verbose && Exceptions::has_exception_counts()) {
740 st->print_cr("OutOfMemory and StackOverflow Exception counts:");
741 Exceptions::print_exception_counts_on_error(st);
742 st->cr();
743 }
744
745 STEP("printing compressed oops mode")
746
747 if (_verbose && UseCompressedOops) {
748 Universe::print_compressed_oops_mode(st);
749 if (UseCompressedClassPointers) {
750 Metaspace::print_compressed_class_space(st);
751 }
752 st->cr();
753 }
754
755 STEP("printing heap information")
756
757 if (_verbose && Universe::is_fully_initialized()) {
758 GC::gc()->heap()->print_on_error(st);
759 st->cr();
760 st->print_cr("Polling page: " INTPTR_FORMAT, p2i(os::get_polling_page()));
761 st->cr();
762 }
763
764 STEP("printing code cache information")
765
766 if (_verbose && Universe::is_fully_initialized()) {
767 // print code cache information before vm abort
768 CodeCache::print_summary(st);
769 st->cr();
770 }
771
772 STEP("printing ring buffers")
773
774 if (_verbose) {
775 Events::print_all(st);
776 st->cr();
777 }
778
915 if (Exceptions::has_exception_counts()) {
916 st->print_cr("OutOfMemory and StackOverflow Exception counts:");
917 Exceptions::print_exception_counts_on_error(st);
918 st->cr();
919 }
920
921 // STEP("printing compressed oops mode")
922
923 if (UseCompressedOops) {
924 Universe::print_compressed_oops_mode(st);
925 if (UseCompressedClassPointers) {
926 Metaspace::print_compressed_class_space(st);
927 }
928 st->cr();
929 }
930
931 // STEP("printing heap information")
932
933 if (Universe::is_fully_initialized()) {
934 MutexLocker hl(Heap_lock);
935 GC::gc()->heap()->print_on_error(st);
936 st->cr();
937 st->print_cr("Polling page: " INTPTR_FORMAT, p2i(os::get_polling_page()));
938 st->cr();
939 }
940
941 // STEP("printing code cache information")
942
943 if (Universe::is_fully_initialized()) {
944 // print code cache information before vm abort
945 CodeCache::print_summary(st);
946 st->cr();
947 }
948
949 // STEP("printing ring buffers")
950
951 Events::print_all(st);
952 st->cr();
953
954 // STEP("printing dynamic libraries")
955
1369 * ensures utilities such as jmap can observe the process is a consistent state.
1370 */
1371 class VM_ReportJavaOutOfMemory : public VM_Operation {
1372 private:
1373 const char* _message;
1374 public:
1375 VM_ReportJavaOutOfMemory(const char* message) { _message = message; }
1376 VMOp_Type type() const { return VMOp_ReportJavaOutOfMemory; }
1377 void doit();
1378 };
1379
1380 void VM_ReportJavaOutOfMemory::doit() {
1381 // Don't allocate large buffer on stack
1382 static char buffer[O_BUFLEN];
1383
1384 tty->print_cr("#");
1385 tty->print_cr("# java.lang.OutOfMemoryError: %s", _message);
1386 tty->print_cr("# -XX:OnOutOfMemoryError=\"%s\"", OnOutOfMemoryError);
1387
1388 // make heap parsability
1389 GC::gc()->heap()->ensure_parsability(false); // no need to retire TLABs
1390
1391 char* cmd;
1392 const char* ptr = OnOutOfMemoryError;
1393 while ((cmd = next_OnError_command(buffer, sizeof(buffer), &ptr)) != NULL){
1394 tty->print("# Executing ");
1395 #if defined(LINUX)
1396 tty->print ("/bin/sh -c ");
1397 #elif defined(SOLARIS)
1398 tty->print ("/usr/bin/sh -c ");
1399 #endif
1400 tty->print_cr("\"%s\"...", cmd);
1401
1402 if (os::fork_and_exec(cmd) < 0) {
1403 tty->print_cr("os::fork_and_exec failed: %s (%s=%d)",
1404 os::strerror(errno), os::errno_name(errno), errno);
1405 }
1406 }
1407 }
1408
1409 void VMError::report_java_out_of_memory(const char* message) {
|