From d7c5c529c58dea75019bab41c838144a7d09e58e Mon Sep 17 00:00:00 2001 From: tstuefe Date: Thu, 15 Jan 2026 16:20:37 +0100 Subject: [PATCH] investigation --- .../share/jfr/leakprofiler/chains/dfsClosure.cpp | 15 ++++++++++++--- .../chains/pathToGcRootsOperation.cpp | 5 ++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/hotspot/share/jfr/leakprofiler/chains/dfsClosure.cpp b/src/hotspot/share/jfr/leakprofiler/chains/dfsClosure.cpp index 5a62bb62a64..a75b388fd3c 100644 --- a/src/hotspot/share/jfr/leakprofiler/chains/dfsClosure.cpp +++ b/src/hotspot/share/jfr/leakprofiler/chains/dfsClosure.cpp @@ -76,7 +76,7 @@ void DFSClosure::find_leaks_from_root_set(EdgeStore* edge_store, // corner cases (very deep hierarchies of broad object arrays) - even // with array chunking, we may bottom out the probe stack then. Here, // we just treat those cases as a "maxdepth reached" case. -static constexpr size_t max_probe_stack_elems = 64 * K; // 1 MB +//static constexpr size_t max_probe_stack_elems = 64 * K; // 1 MB // We use a much smaller array chunk size than GCs do, to avoid running out // of probe stack too early. Reason is that Leak Profiler is often used @@ -86,7 +86,8 @@ static constexpr int array_chunk_size = 64; DFSClosure::DFSClosure(EdgeStore* edge_store, JFRBitSet* mark_bits, const Edge* start_edge) :_edge_store(edge_store), _mark_bits(mark_bits), _start_edge(start_edge), _max_depth(max_dfs_depth), _ignore_root_set(false), - _probe_stack(1024, 4, max_probe_stack_elems), +// _probe_stack(1024, 4, max_probe_stack_elems), + _probe_stack(), _current_item(nullptr) { } @@ -117,6 +118,9 @@ void DFSClosure::handle_oop() { const size_t depth = current_depth(); assert(depth < _max_depth, "Sanity"); + +if (UseNewCode) printf(PTR_FORMAT ", depth %zu\n", p2i(pointee), depth); + if (depth == 0 && _ignore_root_set) { assert(pointee_was_visited(pointee), "We should have already visited roots"); _reference_stack[depth] = _current_item->r; @@ -201,17 +205,22 @@ void DFSClosure::drain_probe_stack() { !GranularTimer::is_finished()) { const ProbeStackItem item = _probe_stack.pop(); + + // anchor current item _current_item = &item; assert(!_current_item->r.is_null(), "invariant"); assert(current_pointee() != nullptr, "invariant"); - if (current_pointee()->is_objArray()) { + //if (current_pointee()->is_objArray()) { +if (false) { handle_objarrayoop(); +printf("handle_objarrayoop\n"); } else { handle_oop(); } + // reset current item _current_item = nullptr; } diff --git a/src/hotspot/share/jfr/leakprofiler/chains/pathToGcRootsOperation.cpp b/src/hotspot/share/jfr/leakprofiler/chains/pathToGcRootsOperation.cpp index 83dc71f3827..799033ee104 100644 --- a/src/hotspot/share/jfr/leakprofiler/chains/pathToGcRootsOperation.cpp +++ b/src/hotspot/share/jfr/leakprofiler/chains/pathToGcRootsOperation.cpp @@ -46,7 +46,10 @@ #include "utilities/globalDefinitions.hpp" PathToGcRootsOperation::PathToGcRootsOperation(ObjectSampler* sampler, EdgeStore* edge_store, int64_t cutoff, bool emit_all, bool skip_bfs) : - _sampler(sampler),_edge_store(edge_store), _cutoff_ticks(cutoff), _emit_all(emit_all), _skip_bfs(skip_bfs) {} + _sampler(sampler),_edge_store(edge_store), _cutoff_ticks(cutoff), _emit_all(emit_all), + //_skip_bfs(skip_bfs) {} +_skip_bfs(true) +{} /* The EdgeQueue is backed by directly managed virtual memory. * We will attempt to dimension an initial reservation