782
783 if (_verbose && Exceptions::has_exception_counts()) {
784 st->print_cr("OutOfMemory and StackOverflow Exception counts:");
785 Exceptions::print_exception_counts_on_error(st);
786 st->cr();
787 }
788
789 STEP("printing compressed oops mode")
790
791 if (_verbose && UseCompressedOops) {
792 Universe::print_compressed_oops_mode(st);
793 if (UseCompressedClassPointers) {
794 Metaspace::print_compressed_class_space(st);
795 }
796 st->cr();
797 }
798
799 STEP("printing heap information")
800
801 if (_verbose && Universe::is_fully_initialized()) {
802 Universe::heap()->print_on_error(st);
803 st->cr();
804 st->print_cr("Polling page: " INTPTR_FORMAT, p2i(os::get_polling_page()));
805 st->cr();
806 }
807
808 STEP("printing code cache information")
809
810 if (_verbose && Universe::is_fully_initialized()) {
811 // print code cache information before vm abort
812 CodeCache::print_summary(st);
813 st->cr();
814 }
815
816 STEP("printing ring buffers")
817
818 if (_verbose) {
819 Events::print_all(st);
820 st->cr();
821 }
822
959 if (Exceptions::has_exception_counts()) {
960 st->print_cr("OutOfMemory and StackOverflow Exception counts:");
961 Exceptions::print_exception_counts_on_error(st);
962 st->cr();
963 }
964
965 // STEP("printing compressed oops mode")
966
967 if (UseCompressedOops) {
968 Universe::print_compressed_oops_mode(st);
969 if (UseCompressedClassPointers) {
970 Metaspace::print_compressed_class_space(st);
971 }
972 st->cr();
973 }
974
975 // STEP("printing heap information")
976
977 if (Universe::is_fully_initialized()) {
978 MutexLocker hl(Heap_lock);
979 Universe::heap()->print_on_error(st);
980 st->cr();
981 st->print_cr("Polling page: " INTPTR_FORMAT, p2i(os::get_polling_page()));
982 st->cr();
983 }
984
985 // STEP("printing code cache information")
986
987 if (Universe::is_fully_initialized()) {
988 // print code cache information before vm abort
989 CodeCache::print_summary(st);
990 st->cr();
991 }
992
993 // STEP("printing ring buffers")
994
995 Events::print_all(st);
996 st->cr();
997
998 // STEP("printing dynamic libraries")
999
1430 * ensures utilities such as jmap can observe the process is a consistent state.
1431 */
1432 class VM_ReportJavaOutOfMemory : public VM_Operation {
1433 private:
1434 const char* _message;
1435 public:
1436 VM_ReportJavaOutOfMemory(const char* message) { _message = message; }
1437 VMOp_Type type() const { return VMOp_ReportJavaOutOfMemory; }
1438 void doit();
1439 };
1440
1441 void VM_ReportJavaOutOfMemory::doit() {
1442 // Don't allocate large buffer on stack
1443 static char buffer[O_BUFLEN];
1444
1445 tty->print_cr("#");
1446 tty->print_cr("# java.lang.OutOfMemoryError: %s", _message);
1447 tty->print_cr("# -XX:OnOutOfMemoryError=\"%s\"", OnOutOfMemoryError);
1448
1449 // make heap parsability
1450 Universe::heap()->ensure_parsability(false); // no need to retire TLABs
1451
1452 char* cmd;
1453 const char* ptr = OnOutOfMemoryError;
1454 while ((cmd = next_OnError_command(buffer, sizeof(buffer), &ptr)) != NULL){
1455 tty->print("# Executing ");
1456 #if defined(LINUX)
1457 tty->print ("/bin/sh -c ");
1458 #elif defined(SOLARIS)
1459 tty->print ("/usr/bin/sh -c ");
1460 #endif
1461 tty->print_cr("\"%s\"...", cmd);
1462
1463 if (os::fork_and_exec(cmd) < 0) {
1464 tty->print_cr("os::fork_and_exec failed: %s (%s=%d)",
1465 os::strerror(errno), os::errno_name(errno), errno);
1466 }
1467 }
1468 }
1469
1470 void VMError::report_java_out_of_memory(const char* message) {
|
782
783 if (_verbose && Exceptions::has_exception_counts()) {
784 st->print_cr("OutOfMemory and StackOverflow Exception counts:");
785 Exceptions::print_exception_counts_on_error(st);
786 st->cr();
787 }
788
789 STEP("printing compressed oops mode")
790
791 if (_verbose && UseCompressedOops) {
792 Universe::print_compressed_oops_mode(st);
793 if (UseCompressedClassPointers) {
794 Metaspace::print_compressed_class_space(st);
795 }
796 st->cr();
797 }
798
799 STEP("printing heap information")
800
801 if (_verbose && Universe::is_fully_initialized()) {
802 GC::gc()->heap()->print_on_error(st);
803 st->cr();
804 st->print_cr("Polling page: " INTPTR_FORMAT, p2i(os::get_polling_page()));
805 st->cr();
806 }
807
808 STEP("printing code cache information")
809
810 if (_verbose && Universe::is_fully_initialized()) {
811 // print code cache information before vm abort
812 CodeCache::print_summary(st);
813 st->cr();
814 }
815
816 STEP("printing ring buffers")
817
818 if (_verbose) {
819 Events::print_all(st);
820 st->cr();
821 }
822
959 if (Exceptions::has_exception_counts()) {
960 st->print_cr("OutOfMemory and StackOverflow Exception counts:");
961 Exceptions::print_exception_counts_on_error(st);
962 st->cr();
963 }
964
965 // STEP("printing compressed oops mode")
966
967 if (UseCompressedOops) {
968 Universe::print_compressed_oops_mode(st);
969 if (UseCompressedClassPointers) {
970 Metaspace::print_compressed_class_space(st);
971 }
972 st->cr();
973 }
974
975 // STEP("printing heap information")
976
977 if (Universe::is_fully_initialized()) {
978 MutexLocker hl(Heap_lock);
979 GC::gc()->heap()->print_on_error(st);
980 st->cr();
981 st->print_cr("Polling page: " INTPTR_FORMAT, p2i(os::get_polling_page()));
982 st->cr();
983 }
984
985 // STEP("printing code cache information")
986
987 if (Universe::is_fully_initialized()) {
988 // print code cache information before vm abort
989 CodeCache::print_summary(st);
990 st->cr();
991 }
992
993 // STEP("printing ring buffers")
994
995 Events::print_all(st);
996 st->cr();
997
998 // STEP("printing dynamic libraries")
999
1430 * ensures utilities such as jmap can observe the process is a consistent state.
1431 */
1432 class VM_ReportJavaOutOfMemory : public VM_Operation {
1433 private:
1434 const char* _message;
1435 public:
1436 VM_ReportJavaOutOfMemory(const char* message) { _message = message; }
1437 VMOp_Type type() const { return VMOp_ReportJavaOutOfMemory; }
1438 void doit();
1439 };
1440
1441 void VM_ReportJavaOutOfMemory::doit() {
1442 // Don't allocate large buffer on stack
1443 static char buffer[O_BUFLEN];
1444
1445 tty->print_cr("#");
1446 tty->print_cr("# java.lang.OutOfMemoryError: %s", _message);
1447 tty->print_cr("# -XX:OnOutOfMemoryError=\"%s\"", OnOutOfMemoryError);
1448
1449 // make heap parsability
1450 GC::gc()->heap()->ensure_parsability(false); // no need to retire TLABs
1451
1452 char* cmd;
1453 const char* ptr = OnOutOfMemoryError;
1454 while ((cmd = next_OnError_command(buffer, sizeof(buffer), &ptr)) != NULL){
1455 tty->print("# Executing ");
1456 #if defined(LINUX)
1457 tty->print ("/bin/sh -c ");
1458 #elif defined(SOLARIS)
1459 tty->print ("/usr/bin/sh -c ");
1460 #endif
1461 tty->print_cr("\"%s\"...", cmd);
1462
1463 if (os::fork_and_exec(cmd) < 0) {
1464 tty->print_cr("os::fork_and_exec failed: %s (%s=%d)",
1465 os::strerror(errno), os::errno_name(errno), errno);
1466 }
1467 }
1468 }
1469
1470 void VMError::report_java_out_of_memory(const char* message) {
|