Mercurial > hg > graal-compiler
comparison 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 |
comparison
equal
deleted
inserted
replaced
1774:ea175c1b79ce | 1775:30f67acf635d |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2005, 2007, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
37 class HeapDumper : public StackObj { | 37 class HeapDumper : public StackObj { |
38 private: | 38 private: |
39 char* _error; | 39 char* _error; |
40 bool _print_to_tty; | 40 bool _print_to_tty; |
41 bool _gc_before_heap_dump; | 41 bool _gc_before_heap_dump; |
42 bool _oome; | |
42 elapsedTimer _t; | 43 elapsedTimer _t; |
44 | |
45 HeapDumper(bool gc_before_heap_dump, bool print_to_tty, bool oome) : | |
46 _gc_before_heap_dump(gc_before_heap_dump), _error(NULL), _print_to_tty(print_to_tty), _oome(oome) { } | |
43 | 47 |
44 // string representation of error | 48 // string representation of error |
45 char* error() const { return _error; } | 49 char* error() const { return _error; } |
46 void set_error(char* error); | 50 void set_error(char* error); |
47 | 51 |
49 bool print_to_tty() const { return _print_to_tty; } | 53 bool print_to_tty() const { return _print_to_tty; } |
50 | 54 |
51 // internal timer. | 55 // internal timer. |
52 elapsedTimer* timer() { return &_t; } | 56 elapsedTimer* timer() { return &_t; } |
53 | 57 |
58 static void dump_heap(bool oome); | |
59 | |
54 public: | 60 public: |
55 HeapDumper(bool gc_before_heap_dump) : | 61 HeapDumper(bool gc_before_heap_dump) : |
56 _gc_before_heap_dump(gc_before_heap_dump), _error(NULL), _print_to_tty(false) { } | 62 _gc_before_heap_dump(gc_before_heap_dump), _error(NULL), _print_to_tty(false), _oome(false) { } |
57 HeapDumper(bool gc_before_heap_dump, bool print_to_tty) : | |
58 _gc_before_heap_dump(gc_before_heap_dump), _error(NULL), _print_to_tty(print_to_tty) { } | |
59 | 63 |
60 ~HeapDumper(); | 64 ~HeapDumper(); |
61 | 65 |
62 // dumps the heap to the specified file, returns 0 if success. | 66 // dumps the heap to the specified file, returns 0 if success. |
63 int dump(const char* path); | 67 int dump(const char* path); |
64 | 68 |
65 // returns error message (resource allocated), or NULL if no error | 69 // returns error message (resource allocated), or NULL if no error |
66 char* error_as_C_string() const; | 70 char* error_as_C_string() const; |
67 | 71 |
68 static void dump_heap() KERNEL_RETURN; | 72 static void dump_heap() KERNEL_RETURN; |
73 | |
74 static void dump_heap_from_oome() KERNEL_RETURN; | |
69 }; | 75 }; |