< prev index next >

src/hotspot/share/jfr/leakprofiler/leakProfiler.cpp

Print this page

 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  *
 23  */
 24 
 25 #include "jfr/leakprofiler/checkpoint/eventEmitter.hpp"
 26 #include "jfr/leakprofiler/leakProfiler.hpp"
 27 #include "jfr/leakprofiler/sampling/objectSampler.hpp"
 28 #include "jfr/leakprofiler/startOperation.hpp"
 29 #include "jfr/leakprofiler/stopOperation.hpp"
 30 #include "jfr/recorder/service/jfrOptionSet.hpp"
 31 #include "logging/log.hpp"
 32 #include "memory/iterator.hpp"
 33 #include "runtime/javaThread.inline.hpp"
 34 #include "runtime/vmThread.hpp"
 35 
 36 bool LeakProfiler::is_supported() {
 37   if (UseShenandoahGC || UseZGC) {
 38     // Leak Profiler uses mark words in the ways that might interfere
 39     // with concurrent GC uses of them. This affects Shenandoah.
 40     //
 41     // Generational ZGC only does weak reference processing in the old generation.
 42     // All objects that would usually die, because we are sampling stuff
 43     // that immediately becomes garbage, will be artificially kept alive
 44     // until an old-generation collection. This incurs a significant
 45     // performance hit by causing allocation stalls.


 46     return false;
 47   }
 48   return true;
 49 }
 50 
 51 bool LeakProfiler::is_running() {
 52   return ObjectSampler::is_created();
 53 }
 54 
 55 bool LeakProfiler::start(int sample_count) {
 56   if (is_running()) {
 57     return true;
 58   }
 59 
 60   // Allows user to disable leak profiler on command line by setting queue size to zero.
 61   if (sample_count == 0) {
 62     return false;
 63   }
 64 
 65   // Exit cleanly if not supported

 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  *
 23  */
 24 
 25 #include "jfr/leakprofiler/checkpoint/eventEmitter.hpp"
 26 #include "jfr/leakprofiler/leakProfiler.hpp"
 27 #include "jfr/leakprofiler/sampling/objectSampler.hpp"
 28 #include "jfr/leakprofiler/startOperation.hpp"
 29 #include "jfr/leakprofiler/stopOperation.hpp"
 30 #include "jfr/recorder/service/jfrOptionSet.hpp"
 31 #include "logging/log.hpp"
 32 #include "memory/iterator.hpp"
 33 #include "runtime/javaThread.inline.hpp"
 34 #include "runtime/vmThread.hpp"
 35 
 36 bool LeakProfiler::is_supported() {
 37   if (UseCompactObjectHeaders || UseShenandoahGC || UseZGC) {
 38     // 1. With a 32-bit mark word in Lilliput2, we don't have enough unused
 39     //    bits to store edge index information in the mark word
 40     // 2. Even without compressed object headers, with Shenandoah, we don't
 41     //    have enough free bits in the mark word because of needing that
 42     //    space for forwarding pointers in the evacuation & update refs phase.
 43     // 3. Generational ZGC only does weak reference processing in the old generation.
 44     //    All objects that would usually die, because we are sampling stuff
 45     //    that immediately becomes garbage, will be artificially kept alive
 46     //    until an old-generation collection. This incurs a significant
 47     //    performance hit by causing allocation stalls.
 48     return false;
 49   }
 50   return true;
 51 }
 52 
 53 bool LeakProfiler::is_running() {
 54   return ObjectSampler::is_created();
 55 }
 56 
 57 bool LeakProfiler::start(int sample_count) {
 58   if (is_running()) {
 59     return true;
 60   }
 61 
 62   // Allows user to disable leak profiler on command line by setting queue size to zero.
 63   if (sample_count == 0) {
 64     return false;
 65   }
 66 
 67   // Exit cleanly if not supported
< prev index next >