Path to GC roots
mat_path2gcFind the shortest reference chains from an object to GC roots to explain why it remains reachable and is not garbage collected.
Instructions
Read-only, synchronous lookup of the shortest reference chains from one object to GC roots, explaining why that object is still reachable and not collected. Returns up to five linear paths plus MAT's path tree. Typical flow: get an object id from mat_object, mat_histogram, mat_dominator, or a mat_leak_suspects preferredObjectId, confirm it with mat_object, then call this tool. Use mat_dominator instead when you want to know which object retains an entire subtree; use mat_leak_suspects when you do not yet have a specific object. Requires the report_id of a parsed dump (status=DONE).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| object | Yes | MAT object id as a decimal integer, copied from the objectId / preferredObjectId field of mat_object, mat_histogram, mat_dominator, or mat_leak_suspects. This endpoint does not accept 0x-prefixed hex. | |
| report_id | Yes | Report ID returned by open_heapdump or dump_java_heap; the dump must have finished parsing (status must be DONE). | |
| excludeWeakSoft | No | true (default) ignores paths through weak, soft, and phantom references, so only strong references that actually pin the object are shown. false includes reference types the GC may clear. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |