diff src/share/vm/services/heapDumper.hpp @ 1775:30f67acf635d

6765718: Indicate which thread throwing OOME when generating the heap dump at OOME Summary: Emit a fake frame that makes it look like the thread is in the OutOfMemoryError zero-parameter constructor Reviewed-by: dcubed
author thurka
date Sat, 11 Sep 2010 08:18:31 +0200
parents c18cbe5936b8
children f95d63e2154a
line wrap: on
line diff
--- a/src/share/vm/services/heapDumper.hpp	Wed Sep 08 08:34:57 2010 -0700
+++ b/src/share/vm/services/heapDumper.hpp	Sat Sep 11 08:18:31 2010 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,8 +39,12 @@
   char* _error;
   bool _print_to_tty;
   bool _gc_before_heap_dump;
+  bool _oome;
   elapsedTimer _t;
 
+  HeapDumper(bool gc_before_heap_dump, bool print_to_tty, bool oome) :
+    _gc_before_heap_dump(gc_before_heap_dump), _error(NULL), _print_to_tty(print_to_tty), _oome(oome) { }
+
   // string representation of error
   char* error() const                   { return _error; }
   void set_error(char* error);
@@ -51,11 +55,11 @@
   // internal timer.
   elapsedTimer* timer()                 { return &_t; }
 
+  static void dump_heap(bool oome);
+
  public:
   HeapDumper(bool gc_before_heap_dump) :
-    _gc_before_heap_dump(gc_before_heap_dump), _error(NULL), _print_to_tty(false) { }
-  HeapDumper(bool gc_before_heap_dump, bool print_to_tty) :
-    _gc_before_heap_dump(gc_before_heap_dump), _error(NULL), _print_to_tty(print_to_tty) { }
+    _gc_before_heap_dump(gc_before_heap_dump), _error(NULL), _print_to_tty(false), _oome(false) { }
 
   ~HeapDumper();
 
@@ -66,4 +70,6 @@
   char* error_as_C_string() const;
 
   static void dump_heap()    KERNEL_RETURN;
+
+  static void dump_heap_from_oome()    KERNEL_RETURN;
 };