Skip to content

Commit 0f9e8a1

Browse files
pyricauclaude
andcommitted
Update changelog: high-level summary of AI investigation skill and shark improvements
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 612aa0a commit 0f9e8a1

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

docs/changelog.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ Please thank our [contributors](https://github.com/square/leakcanary/graphs/cont
55

66
## Unreleased
77

8-
* **`shark-cli` / `ai-investigate`**: new `retained-size @<objectId>` command computes the memory retained by an object — the total memory that would be freed if it were garbage-collected. The AI agent is now automatically instructed to run it on the first leaking object after identifying a leak and report the result.
9-
* **New `SingleObjectRetainedSizeCalculator` in `shark`**: computes the retained size of a single heap object using the exclude-and-reach two-BFS algorithm, which is provably correct for any reference graph without assumptions about traversal order.
10-
* **`ShallowSizeCalculator` bug fixes**: array objects were previously missing their 12–16 byte object header (the header size rounds up `kFirstElementOffset=12` to the component alignment, per ART's `array.h`). Object and primitive arrays now report correct sizes.
11-
* **`ShallowSizeCalculator` class size improvement**: class object size now uses static field value sizes plus `ArtField` metadata (16 B per declared field in `LinearAlloc`) instead of the HPROF record size, which was inflated by name string IDs, type bytes, and instance-field declarations that are not in memory.
12-
* **New `HeapClass.readInstanceFieldCount()`**: reads the declared instance field count as a single short from the class fields buffer, without allocating a `List<FieldRecord>`.
8+
`shark-cli` gains a new **AI-driven leak investigation skill**: run `shark-ai-investigate --hprof <file>` to load a heap dump and start a session. A shell wrapper prints a session shortcode, then starts the `ai-investigate` daemon in the background. An AI agent (or a human) can then send commands to the daemon via `ai-investigate-cmd <shortcode> <command>` — all over named pipes. Commands include `trace` (leak traces as structured JSON), `fields` / `string` / `array` (inspect objects), `mark-leaking` / `mark-not-leaking` (supply context), `retained-size` (memory retained by an object), and `human-readable-trace` (plain-text summary). The skill embeds a full algorithm guide in its `--help` output so an AI agent can drive the investigation autonomously.
9+
10+
New in `shark`:
11+
12+
* **`SingleObjectRetainedSizeCalculator`**: computes the retained size of a single heap object (the total memory freed if it were GC'd) using the provably-correct exclude-and-reach two-BFS algorithm.
13+
* **`HeapClass.readInstanceFieldCount()`**: reads the declared instance field count as a single unsigned short from the class fields buffer, without allocating field records.
14+
* **`ShallowSizeCalculator` accuracy improvements**: array objects now include the 12–16 byte ART object header that HPROF omits from array records; class object size now uses static field value sizes plus `ArtField` metadata (16 B × field count in `LinearAlloc`) instead of the raw HPROF record size.
1315

1416
## Version 3.0 Alpha 8 (2024-06-04)
1517

0 commit comments

Comments
 (0)