1545 static char buffer[O_BUFLEN]; 1546 1547 tty->print_cr("#"); 1548 tty->print_cr("# java.lang.OutOfMemoryError: %s", _message); 1549 tty->print_cr("# -XX:OnOutOfMemoryError=\"%s\"", OnOutOfMemoryError); 1550 1551 // make heap parsability 1552 Universe::heap()->ensure_parsability(false); // no need to retire TLABs 1553 1554 char* cmd; 1555 const char* ptr = OnOutOfMemoryError; 1556 while ((cmd = next_OnError_command(buffer, sizeof(buffer), &ptr)) != NULL){ 1557 tty->print("# Executing "); 1558 #if defined(LINUX) 1559 tty->print ("/bin/sh -c "); 1560 #elif defined(SOLARIS) 1561 tty->print ("/usr/bin/sh -c "); 1562 #endif 1563 tty->print_cr("\"%s\"...", cmd); 1564 1565 if (os::fork_and_exec(cmd) < 0) { 1566 tty->print_cr("os::fork_and_exec failed: %s (%s=%d)", 1567 os::strerror(errno), os::errno_name(errno), errno); 1568 } 1569 } 1570 } 1571 1572 void VMError::report_java_out_of_memory(const char* message) { 1573 if (OnOutOfMemoryError && OnOutOfMemoryError[0]) { 1574 MutexLocker ml(Heap_lock); 1575 VM_ReportJavaOutOfMemory op(message); 1576 VMThread::execute(&op); 1577 } 1578 } 1579 1580 void VMError::show_message_box(char *buf, int buflen) { 1581 bool yes; 1582 do { 1583 error_string(buf, buflen); 1584 yes = os::start_debugging(buf,buflen); 1585 } while (yes); | 1545 static char buffer[O_BUFLEN]; 1546 1547 tty->print_cr("#"); 1548 tty->print_cr("# java.lang.OutOfMemoryError: %s", _message); 1549 tty->print_cr("# -XX:OnOutOfMemoryError=\"%s\"", OnOutOfMemoryError); 1550 1551 // make heap parsability 1552 Universe::heap()->ensure_parsability(false); // no need to retire TLABs 1553 1554 char* cmd; 1555 const char* ptr = OnOutOfMemoryError; 1556 while ((cmd = next_OnError_command(buffer, sizeof(buffer), &ptr)) != NULL){ 1557 tty->print("# Executing "); 1558 #if defined(LINUX) 1559 tty->print ("/bin/sh -c "); 1560 #elif defined(SOLARIS) 1561 tty->print ("/usr/bin/sh -c "); 1562 #endif 1563 tty->print_cr("\"%s\"...", cmd); 1564 1565 #if defined(LINUX) 1566 if (os::vfork_and_exec(cmd) < 0) { 1567 #else 1568 if (os::fork_and_exec(cmd) < 0) { 1569 #endif 1570 tty->print_cr("os::fork_and_exec failed: %s (%s=%d)", 1571 os::strerror(errno), os::errno_name(errno), errno); 1572 } 1573 } 1574 } 1575 1576 void VMError::report_java_out_of_memory(const char* message) { 1577 if (OnOutOfMemoryError && OnOutOfMemoryError[0]) { 1578 MutexLocker ml(Heap_lock); 1579 VM_ReportJavaOutOfMemory op(message); 1580 VMThread::execute(&op); 1581 } 1582 } 1583 1584 void VMError::show_message_box(char *buf, int buflen) { 1585 bool yes; 1586 do { 1587 error_string(buf, buflen); 1588 yes = os::start_debugging(buf,buflen); 1589 } while (yes); |