RFR: 8373096: JFR: Path-to-gc-roots search should be non-recursive [v6]

Thomas Stuefe stuefe at openjdk.org
Tue Feb 3 14:45:28 UTC 2026


On Tue, 3 Feb 2026 14:05:51 GMT, Erik Gahlin <egahlin at openjdk.org> wrote:

> I wonder if you have looked at performance. For example, in which order is it best to check for nullptr, oop has been visited or whether the stack is full? You added a _num_objects_processed variable, but it’s never used, so you might want to remove it.

Will do.

> For the future, I think we want to keep BFS. Initially, I only had DFS, but the chains became so weird that I had to implement BFS.

Sure; you are the maintainer, after all.

> 
> Regarding ordering, I think we want an order that makes the most sense to the user. ClassLoader is easier for users to understand than Global Object Handle. I'm not sure if that code is still present, but we had a specific order in which we processed roots.

Did you mean this?


 https://github.com/openjdk/jdk/blob/99bc98357dab78bef2cce7a10c98d13d1e5730e3/src/hotspot/share/jfr/leakprofiler/chains/rootSetClosure.cpp#L87-L97 

I can reverse the order in there and thus get the (roughly) reversed order. I already tested that, but refrained from adding it to the patch. 

What do you think about printing the actual (first, first and second ...) objects that are referenced by the roots? I think that would often help a lot. It helped me a lot in understanding what happened.

In fact, I just traced the whole chain during development, hence the logging added to add_chain().

-------------

PR Comment: https://git.openjdk.org/jdk/pull/29382#issuecomment-3841744021


More information about the hotspot-dev mailing list