equal
deleted
inserted
replaced
321 |
321 |
322 // A number of threads may attempt to report OutOfMemoryError at around the |
322 // A number of threads may attempt to report OutOfMemoryError at around the |
323 // same time. To avoid dumping the heap or executing the data collection |
323 // same time. To avoid dumping the heap or executing the data collection |
324 // commands multiple times we just do it once when the first threads reports |
324 // commands multiple times we just do it once when the first threads reports |
325 // the error. |
325 // the error. |
326 if (Atomic::cmpxchg(1, &out_of_memory_reported, 0) == 0) { |
326 if (Atomic::cmpxchg(&out_of_memory_reported, 0, 1) == 0) { |
327 // create heap dump before OnOutOfMemoryError commands are executed |
327 // create heap dump before OnOutOfMemoryError commands are executed |
328 if (HeapDumpOnOutOfMemoryError) { |
328 if (HeapDumpOnOutOfMemoryError) { |
329 tty->print_cr("java.lang.OutOfMemoryError: %s", message); |
329 tty->print_cr("java.lang.OutOfMemoryError: %s", message); |
330 HeapDumper::dump_heap_from_oome(); |
330 HeapDumper::dump_heap_from_oome(); |
331 } |
331 } |
760 return false; // unprotecting memory may fail in OOM situations, as surprising as this sounds. |
760 return false; // unprotecting memory may fail in OOM situations, as surprising as this sounds. |
761 } |
761 } |
762 // Store Context away. |
762 // Store Context away. |
763 if (ucVoid) { |
763 if (ucVoid) { |
764 const intx my_tid = os::current_thread_id(); |
764 const intx my_tid = os::current_thread_id(); |
765 if (Atomic::cmpxchg(my_tid, &g_asserting_thread, (intx)0) == 0) { |
765 if (Atomic::cmpxchg(&g_asserting_thread, (intx)0, my_tid) == 0) { |
766 store_context(ucVoid); |
766 store_context(ucVoid); |
767 g_assertion_context = &g_stored_assertion_context; |
767 g_assertion_context = &g_stored_assertion_context; |
768 } |
768 } |
769 } |
769 } |
770 return true; |
770 return true; |
771 } |
771 } |
772 return false; |
772 return false; |
773 } |
773 } |
774 #endif // CAN_SHOW_REGISTERS_ON_ASSERT |
774 #endif // CAN_SHOW_REGISTERS_ON_ASSERT |
775 |
|