src/share/vm/services/heapDumper.cpp

changeset 3272
2ceafe3ceb65
parent 2895
167b70ff3abc
child 3900
d2a62e0f25eb
     1.1 --- a/src/share/vm/services/heapDumper.cpp	Tue Nov 15 20:17:33 2011 +0100
     1.2 +++ b/src/share/vm/services/heapDumper.cpp	Wed Nov 16 16:27:29 2011 -0800
     1.3 @@ -27,6 +27,7 @@
     1.4  #include "classfile/systemDictionary.hpp"
     1.5  #include "classfile/vmSymbols.hpp"
     1.6  #include "gc_implementation/shared/vmGCOperations.hpp"
     1.7 +#include "memory/gcLocker.inline.hpp"
     1.8  #include "memory/genCollectedHeap.hpp"
     1.9  #include "memory/universe.hpp"
    1.10  #include "oops/objArrayKlass.hpp"
    1.11 @@ -1709,11 +1710,16 @@
    1.12  
    1.13    HandleMark hm;
    1.14    CollectedHeap* ch = Universe::heap();
    1.15 +
    1.16 +  ch->ensure_parsability(false); // must happen, even if collection does
    1.17 +                                 // not happen (e.g. due to GC_locker)
    1.18 +
    1.19    if (_gc_before_heap_dump) {
    1.20 -    ch->collect_as_vm_thread(GCCause::_heap_dump);
    1.21 -  } else {
    1.22 -    // make the heap parsable (no need to retire TLABs)
    1.23 -    ch->ensure_parsability(false);
    1.24 +    if (GC_locker::is_active()) {
    1.25 +      warning("GC locker is held; pre-heapdump GC was skipped");
    1.26 +    } else {
    1.27 +      ch->collect_as_vm_thread(GCCause::_heap_dump);
    1.28 +    }
    1.29    }
    1.30  
    1.31    // At this point we should be the only dumper active, so

mercurial