memorydetective 1.9.0 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -1
- package/README.md +12 -9
- package/dist/parsers/referenceTree.d.ts +46 -8
- package/dist/parsers/referenceTree.js +194 -11
- package/dist/parsers/referenceTree.js.map +1 -1
- package/dist/runtime/responseFormatter.d.ts +24 -1
- package/dist/runtime/responseFormatter.js +109 -2
- package/dist/runtime/responseFormatter.js.map +1 -1
- package/dist/tools/analyzeAbandonedMemory.d.ts +26 -4
- package/dist/tools/analyzeAbandonedMemory.js +45 -7
- package/dist/tools/analyzeAbandonedMemory.js.map +1 -1
- package/dist/tools/analyzeAllocations.d.ts +3 -3
- package/dist/tools/analyzeAnimationHitches.d.ts +3 -3
- package/dist/tools/analyzeAppLaunch.d.ts +3 -3
- package/dist/tools/analyzeHangs.d.ts +3 -3
- package/dist/tools/analyzeMemgraph.d.ts +22 -3
- package/dist/tools/analyzeMemgraph.js +18 -4
- package/dist/tools/analyzeMemgraph.js.map +1 -1
- package/dist/tools/analyzeTimeProfile.d.ts +3 -3
- package/dist/tools/cleanupTraces.d.ts +4 -4
- package/dist/tools/diffMemgraphs.d.ts +3 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,30 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [1.10.0] - 2026-05-14
|
|
10
|
+
|
|
11
|
+
Notelet retro feedback loop: re-running the v1.9 abandoned-memory tools against the same memgraphs that originally drove the v1.9.0 release surfaced three concrete gaps. This minor patches all of them so the notelet investigation's headline finding (AVPlayerItem went 342 to 0, KVO observer never invalidated) is reproducible end-to-end via JSON instead of requiring a manual `leaks --debug=stacks` grep.
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- **`analyzeMemgraph.abandonedMemorySuspects[]`** parallel to `abandonedMemoryTop[]`. The raw view kept its semantics (top-N classes by live instance count, including framework collections + ObjC runtime metadata) for cache-bloat-shaped investigations. The new "suspects" view applies a `isFrameworkNoise()` filter on the same data, so AV* / KVO* / app-level classes surface even when ranked below NSMutableDictionary / CFString / `__DATA __bss` in the raw view. Internally captures a 10x pool (min 200 entries) so post-filter ranking still has enough headroom to surface classes that v1.9 left invisible at default `referenceTreeTopN: 20`. Validated on the notelet pre-fix memgraph: AVPlayerItem at raw rank 82 surfaces at suspect rank 13 of 20.
|
|
16
|
+
|
|
17
|
+
- **`analyzeAbandonedMemory.actionableGrowth[]` + `actionableShrinkage[]`** parallel to the existing `growthByClass[]` + `shrinkageByClass[]`. Same noise filter applied. The verify-fix loop becomes "did `actionableShrinkage` lead with the suspect class?" instead of "scroll past 25 framework noise rows to find AVPlayerItem". Validated on the notelet pre-fix vs post-fix diff: `actionableShrinkage[]` leads with AVCMNotificationDispatcher (1802 to 4), AVCMNotificationDispatcherListenerKey (603 to 0), AVPlayerItem (342 to 0), AVPlayerInternal (297 to 0), AVPlayerPlaybackCoordinator (290 to 0), all the AVFoundation classes the fix actually freed.
|
|
18
|
+
|
|
19
|
+
- **`outputFormat: "verify-fix-table"`** value on the shared `outputFormatField`. When set on `analyzeAbandonedMemory`, the response is a focused 4-column markdown table (Class | Before | After | Delta) of the actionable rows (|delta| >= 10), split into "What the fix freed" (shrinkage) and "Classes that grew (regressions or unrelated)" (growth), plus a trailing diagnosis blockquote. Other tools fall back to standard markdown. The hand-built comparison table in the notelet follow-up post is reproducible from a single call now. 7 new unit tests in `src/runtime/responseFormatter.test.ts` cover the renderer + threshold filter + the formatMcpResponse routing.
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- **`extractClassName` parser fix.** The allocator filter (`malloc | calloc | realloc`) now runs AFTER the arrow split, so entries like `unaligned --> calloc in quic_stream_allocate` are correctly dropped (the v1.9 filter only ran against the original label, missing allocator names on the RHS of arrows). 1 new unit test covering this exact case.
|
|
24
|
+
|
|
25
|
+
- **`extractClassName` normalizes bracketed instance forms.** `<ClassName 0xADDR> [size]` and `<ClassName 0xADDR>` patterns now resolve to `ClassName`. Without this normalization, each address became its own aggregation key and the same logical class appeared as N separate rows in the top-N list. Arrow-targeted entries (e.g. `_object --> <NSObject 0xADDR>`) now aggregate correctly with the root-level form. 5 new unit tests cover the new patterns (with size, without size, after arrow, namespaced names like `SwiftUI.ViewGraph`, allocator-in-brackets filtering).
|
|
26
|
+
|
|
27
|
+
- **Classifier escalation tightened (`analyzeAbandonedMemory.classifyGrowth`).** Three guards added to the KVO co-occurrence path so framework noise stops getting tagged `kvo-observer-orphaned high` whenever `NSKeyValueObservance` grows: (1) `isFrameworkNoise()` filter rejects allocator stacks, memory zones, `__DATA` sections, summary rows, and Foundation collection types from escalation, (2) non-object-shaped candidates (bracketed anonymous forms `<X 0xADDR> [size]`, byte-offset prefixes like `8600 bytes into ...`) are rejected, (3) proportional thresholds replace the flat `delta >= 5` rule (medium requires `delta >= max(5, kvoObservanceDelta * 0.5)`; high requires `delta >= max(50, kvoObservanceDelta * 5)`). On the notelet swapped-direction analysis the false-positive count dropped from 25 high-confidence-tagged classes to ~1 (AVPlayerItem alone, correctly). 7 new unit tests cover the three guards plus the existing classifier paths.
|
|
28
|
+
|
|
29
|
+
### Fixed
|
|
30
|
+
|
|
31
|
+
- The notelet-followup post draft's claim that `analyzeAbandonedMemory` "tags AVPlayerItem with kvo-observer-orphaned at high confidence in one call" is now reproducible on v1.10 (was technically incorrect on v1.9 against the cited memgraphs; v1.9's parser left AVPlayerItem at rank ~82 and the over-broad classifier obscured it under 25 false positives).
|
|
32
|
+
|
|
9
33
|
## [1.9.0] - 2026-05-14
|
|
10
34
|
|
|
11
35
|
### Added
|
|
@@ -385,7 +409,8 @@ When called with no arguments it starts the MCP server over stdio.
|
|
|
385
409
|
- **`captureMemgraph`** does not work on physical iOS devices — `leaks(1)` only attaches to processes on the local Mac (which includes iOS simulators). Memory Graph capture from a physical device still requires Xcode.
|
|
386
410
|
- **`detectLeaksInXCUITest`** is flagged experimental: orchestration logic is implemented but not yet validated against a wide set of production XCUITest runs.
|
|
387
411
|
|
|
388
|
-
[Unreleased]: https://github.com/carloshpdoc/memorydetective/compare/v1.
|
|
412
|
+
[Unreleased]: https://github.com/carloshpdoc/memorydetective/compare/v1.10.0...HEAD
|
|
413
|
+
[1.10.0]: https://github.com/carloshpdoc/memorydetective/compare/v1.9.0...v1.10.0
|
|
389
414
|
[1.9.0]: https://github.com/carloshpdoc/memorydetective/compare/v1.8.1...v1.9.0
|
|
390
415
|
[1.4.0]: https://github.com/carloshpdoc/memorydetective/compare/v1.3.1...v1.4.0
|
|
391
416
|
[1.3.1]: https://github.com/carloshpdoc/memorydetective/compare/v1.3.0...v1.3.1
|
package/README.md
CHANGED
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
- **MCP-native.** Plugs into Claude Code, Claude Desktop, Cursor, Cline, and any other MCP client. The agent drives the full investigate → classify → suggest-fix loop without you opening Instruments.
|
|
18
18
|
- **Honest about its limits.** No mocked outputs, no over-promises. Hangs analysis works clean from `xctrace`; sample-level Time Profile is parsed when `xctrace` symbolicates the trace and returns a structured workaround notice when it can't (the underlying `xctrace` SIGSEGV on heavy unsymbolicated traces is an Apple-side limitation we surface explicitly). Memory Graph capture works on Mac apps and iOS simulator; physical iOS devices still need Xcode.
|
|
19
19
|
|
|
20
|
-
> **What's new in v1.
|
|
20
|
+
> **What's new in v1.10** (2026-05-14): notelet retro feedback loop. Re-running the v1.9 abandoned-memory pipeline against the same memgraphs that originally drove the v1.9 release surfaced three gaps that v1.10 closes end to end. (1) The reference-tree parser now normalizes `<ClassName 0xADDR> [size]` to `ClassName` so addresses no longer fragment a single logical class across N rows. (2) New `abandonedMemorySuspects[]` and `actionable*[]` views filter framework noise (NSMutableDictionary, CFString, `__DATA __bss`, allocator stacks, etc.) so AVPlayerItem-style app-level + AV-framework classes surface even when ranked below the noise leaders. (3) The `kvo-observer-orphaned` classifier gained noise + object-shape + proportional-ratio guards, dropping notelet-shape false positives from 25 to 1. New `outputFormat: "verify-fix-table"` emits a 4-column markdown comparison table (Class | Before | After | Delta) directly from `analyzeAbandonedMemory`, replacing hand-built comparison tables in published artifacts. 457 → 487 tests.
|
|
21
21
|
>
|
|
22
|
-
> **Also recent**: v1.8 (2026-05-06) shipped the macOS 26.x `task_for_pid` workaround chain + verify-fix loop. v1.7 (2026-05-03) added `fixTemplate` snippets and `compareTracesByPattern`. Full notes in [CHANGELOG](./CHANGELOG.md).
|
|
22
|
+
> **Also recent**: v1.9 (same day) shipped `analyzeAbandonedMemory` + `detectLeaksInXCTest` + `cleanupTraces` + `mainThreadViolations` + security env flags. v1.8 (2026-05-06) shipped the macOS 26.x `task_for_pid` workaround chain + verify-fix loop. v1.7 (2026-05-03) added `fixTemplate` snippets and `compareTracesByPattern`. Full notes in [CHANGELOG](./CHANGELOG.md).
|
|
23
23
|
|
|
24
24
|
> **Heads up for macOS 26.x users:** Apple shipped a `task_for_pid` kernel regression on macOS 26.x that blocks `leaks --outputGraph`, `heap`, AND `xctrace --template Allocations` against iOS simulator processes regardless of `MallocStackLogging`. Even Xcode's "View Memory Graph Hierarchy" hits it unless `Malloc Stack Logging` is enabled in the scheme's Diagnostics tab. memorydetective surfaces this as a proactive `platformAdvisory` on the first capture-class tool call, plus a `workaroundNotice` with `issue: "macos-26-task-for-pid-broken"` if `leaks` is invoked. **The most reliable workaround today is to target an iOS 18 simulator runtime** (install via Xcode > Settings > Platforms > +iOS 18.x). Empirically validated in the [notelet investigation](https://github.com/carloshpdoc/memorydetective/blob/main/CHANGELOG.md#unreleased) 2026-05-12 where three independent CLI memory-introspection paths all failed before iOS 18 was identified as the working escape hatch. Set `MEMORYDETECTIVE_SUPPRESS_PLATFORM_ADVISORY=1` to silence the notice once you have settled on a workaround.
|
|
25
25
|
|
|
@@ -316,7 +316,7 @@ The cycle classifier ships **36 named antipatterns** spanning SwiftUI (including
|
|
|
316
316
|
| `countAlive` | Count instances by class. Provide `className` for one number, or omit for top-N most-leaked classes. |
|
|
317
317
|
| `reachableFromCycle` | Cycle-scoped reachability. "How many `<X>` instances are reachable from the cycle rooted at `<Y>`?". Distinguishes the actual culprit from its retained dependencies. |
|
|
318
318
|
| `diffMemgraphs` | Compare two `.memgraph` snapshots: total deltas + class-count changes + cycles new/gone/persisted. |
|
|
319
|
-
| `analyzeAbandonedMemory` | Diff two `.memgraph` snapshots on heap reference-tree class counts (not cycle list) and classify each grown class as `kvo-observer-orphaned`, `notificationcenter-observer-leaked`, `cache-too-aggressive`, `singleton-retains-payload`, or `unknown-growth`. Surfaces the family of bugs `leaks(1)` reports as `leakCount: 0` because no strict cycle exists. |
|
|
319
|
+
| `analyzeAbandonedMemory` | Diff two `.memgraph` snapshots on heap reference-tree class counts (not cycle list) and classify each grown class as `kvo-observer-orphaned`, `notificationcenter-observer-leaked`, `cache-too-aggressive`, `singleton-retains-payload`, or `unknown-growth`. Surfaces the family of bugs `leaks(1)` reports as `leakCount: 0` because no strict cycle exists. v1.10 adds `actionableGrowth[]` + `actionableShrinkage[]` (framework-noise-filtered views) and supports `outputFormat: "verify-fix-table"` which emits a focused Class \| Before \| After \| Delta markdown table directly. |
|
|
320
320
|
| `verifyFix` | Cycle-semantic diff: per-pattern PASS/PARTIAL/FAIL verdict + bytes freed. CI-gateable. |
|
|
321
321
|
| `classifyCycle` | Match each ROOT CYCLE against a built-in catalog of **36 named antipatterns** (SwiftUI / Combine / Concurrency / UIKit / Core Animation / Core Data / Coordinator / RxSwift / Realm) with confidence + textual `fixHint` + `staticAnalysisHint` (which SwiftLint rule complements this, or explicit gap) + `fixTemplate` (Swift before/after snippet). |
|
|
322
322
|
| `analyzeHangs` | Parse `xctrace` `potential-hangs` schema; return Hang vs Microhang counts + top N longest. Pass `topFramesByHangStartNs` (typically from a chained `analyzeTimeProfile` correlation) to enrich each top hang with `mainThreadViolations[]` classifying the blocker as `sync-io`, `db-lock`, `network`, or `lock-contention`. |
|
|
@@ -458,21 +458,24 @@ Investigation playbooks are exposed as MCP prompts (slash commands in clients th
|
|
|
458
458
|
| `/investigate-launch` | Diagnose cold/warm launch slowness from a `.trace`. | `tracePath` |
|
|
459
459
|
| `/verify-cycle-fix` | Diff a before/after pair of `.memgraph` snapshots to confirm a fix landed. | `before`, `after` |
|
|
460
460
|
|
|
461
|
-
Each prompt fills the canonical playbook's argument templates with the user-provided values, then hands the agent a ready-to-execute brief. Calls the same tools listed in [Read & analyze](#read--analyze-
|
|
461
|
+
Each prompt fills the canonical playbook's argument templates with the user-provided values, then hands the agent a ready-to-execute brief. Calls the same tools listed in [Read & analyze](#read--analyze-14). Prompts are an orchestration shortcut, not a separate engine.
|
|
462
462
|
|
|
463
463
|
### CLI mode
|
|
464
464
|
|
|
465
465
|
The same binary is also a thin CLI for scripting and CI:
|
|
466
466
|
|
|
467
467
|
```bash
|
|
468
|
-
memorydetective analyze <path-to-.memgraph>
|
|
469
|
-
memorydetective classify <path-to-.memgraph>
|
|
468
|
+
memorydetective analyze <path-to-.memgraph> # totals, ROOT CYCLEs, diagnosis
|
|
469
|
+
memorydetective classify <path-to-.memgraph> # match patterns + render fix hint
|
|
470
|
+
memorydetective tool <toolName> --input <json> # generic dispatcher for any MCP tool
|
|
470
471
|
memorydetective --help
|
|
471
472
|
memorydetective --version
|
|
472
473
|
```
|
|
473
474
|
|
|
474
475
|
When called with no arguments, the binary starts as an MCP server over stdio.
|
|
475
476
|
|
|
477
|
+
The `tool` subcommand dispatches to any registered MCP tool by name, reading inputs from a JSON file. Exit code is `0` when the tool returns `ok && passed !== false`, `1` otherwise, so it slots cleanly into CI gates. Currently supported tool names: `detectLeaksInXCTest`, `detectLeaksInXCUITest` (the [CI recipe](#add-memorydetective-to-your-ci-in-5-minutes) above uses this).
|
|
478
|
+
|
|
476
479
|
---
|
|
477
480
|
|
|
478
481
|
## Requirements
|
|
@@ -486,7 +489,7 @@ When called with no arguments, the binary starts as an MCP server over stdio.
|
|
|
486
489
|
git clone https://github.com/carloshpdoc/memorydetective
|
|
487
490
|
cd memorydetective
|
|
488
491
|
npm install
|
|
489
|
-
npm test #
|
|
492
|
+
npm test # 487 unit tests
|
|
490
493
|
npm run build # build → dist/
|
|
491
494
|
npm run dev # tsx, stdio mode (dev mode)
|
|
492
495
|
./scripts/demo.sh # full demo against a real .memgraph (set MEMGRAPH=path)
|
|
@@ -497,11 +500,11 @@ npm run dev # tsx, stdio mode (dev mode)
|
|
|
497
500
|
Contributions are welcome. Bug reports, feature requests, new cycle patterns, all of it.
|
|
498
501
|
|
|
499
502
|
- **Bugs / feature requests**: [open an issue](https://github.com/carloshpdoc/memorydetective/issues).
|
|
500
|
-
- **PRs**: fork → branch → `npm install` → make changes → `npm test` (
|
|
503
|
+
- **PRs**: fork → branch → `npm install` → make changes → `npm test` (487 tests must stay green) → open a PR with a concise description of what changed and why.
|
|
501
504
|
|
|
502
505
|
### Adding a cycle pattern to `classifyCycle`
|
|
503
506
|
|
|
504
|
-
`classifyCycle` ships with
|
|
507
|
+
`classifyCycle` ships with 36 built-in patterns covering SwiftUI (incl. Swift 6 / `@Observable` / SwiftData / NavigationStack / the v1.9 `observable-write-on-every-render` and `viewcontroller-retained-after-pop` shapes), Combine, Swift Concurrency (incl. AsyncSequence-on-self and `Observations`), UIKit (Timer / CADisplayLink / UIGestureRecognizer / KVO / URLSession / WebKit / DispatchSource), Core Animation, Core Data, the Coordinator pattern, RxSwift, and Realm. To add one:
|
|
505
508
|
|
|
506
509
|
1. Edit `src/tools/classifyCycle.ts`. Add an entry to `PATTERNS` with `id`, `name`, `fixHint`, and a `match` function.
|
|
507
510
|
2. Add a test in `src/tools/readTools.test.ts` that asserts the new pattern fires against a representative memgraph fixture.
|
|
@@ -47,17 +47,55 @@ export declare function parseSizeBytes(raw: string): number;
|
|
|
47
47
|
/**
|
|
48
48
|
* Pure: extract the class name from a leaks reference-tree line value.
|
|
49
49
|
*
|
|
50
|
-
* - "AVPlayerItem"
|
|
51
|
-
* - "_playerItem --> AVPlayerItemInternal"
|
|
52
|
-
* - "__strong _object --> NSKeyValueObservance"
|
|
53
|
-
* - ""
|
|
50
|
+
* - "AVPlayerItem" -> "AVPlayerItem"
|
|
51
|
+
* - "_playerItem --> AVPlayerItemInternal" -> "AVPlayerItemInternal"
|
|
52
|
+
* - "__strong _object --> NSKeyValueObservance" -> "NSKeyValueObservance"
|
|
53
|
+
* - "<CFDictionary 0x6000029c4840> [64]" -> "CFDictionary"
|
|
54
|
+
* - "<NSMutableDictionary 0x600003ccf5c0> [32]" -> "NSMutableDictionary"
|
|
55
|
+
* - "_object --> <NSObject 0x14f100> [16]" -> "NSObject"
|
|
56
|
+
* - "" -> null (caller skips)
|
|
54
57
|
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
58
|
+
* The `<ClassName 0xADDR> [size]` form is what `leaks --referenceTree` emits
|
|
59
|
+
* for arrow-targeted instances (e.g. `_object --> <NSObject 0xADDR>`).
|
|
60
|
+
* Without normalization, each address becomes its own aggregation key and
|
|
61
|
+
* the same logical class shows up as N separate rows in the top-N list.
|
|
62
|
+
* Normalizing to the base class name (the token inside the `<...>`) folds
|
|
63
|
+
* those rows back together. This is the v1.10 fix for the gap where
|
|
64
|
+
* AVPlayerItem-style classes appeared aggregated at the root level but
|
|
65
|
+
* NSMutableDictionary-style classes appeared per-address in arrow targets.
|
|
66
|
+
*
|
|
67
|
+
* Excludes c-runtime allocations like `malloc in FigSimpleMutex...` AND the
|
|
68
|
+
* bracketed form `<malloc in ...>` / `<calloc in ...>` / `<realloc in ...>`
|
|
69
|
+
* that leaks emits alongside Obj-C/Swift classes; those are not actionable
|
|
70
|
+
* for abandoned-memory triage and would inflate the top-N list with
|
|
71
|
+
* low-signal entries.
|
|
59
72
|
*/
|
|
60
73
|
export declare function extractClassName(rawLabel: string): string | null;
|
|
74
|
+
/**
|
|
75
|
+
* Pure: returns true when the class name is framework-noise that crowds out
|
|
76
|
+
* actionable classes in the abandoned-memory top-N list. Used by the
|
|
77
|
+
* `analyzeMemgraph` and `analyzeAbandonedMemory` tools to populate a
|
|
78
|
+
* `*Suspects[]` / `actionable*[]` field alongside the raw `*Top[]` field.
|
|
79
|
+
*
|
|
80
|
+
* The list catalogs:
|
|
81
|
+
* - Foundation collection types (`NSMutableDictionary`, `CFString`, etc.)
|
|
82
|
+
* that grow with normal app activity and are rarely the leak itself
|
|
83
|
+
* - ObjC runtime / metadata classes (`Class.data`, `OBJC_METACLASS_$...`)
|
|
84
|
+
* - Apple system frameworks' static data sections (`__DATA __bss`,
|
|
85
|
+
* `__DATA __data`, `__DATA __common`)
|
|
86
|
+
* - `<<TOTAL>>` summary row
|
|
87
|
+
* - "Stack of thread N" and similar meta-rows
|
|
88
|
+
* - Non-object zone descriptors and memory-zone metadata
|
|
89
|
+
*
|
|
90
|
+
* Deliberately NOT noise: AV*, NSKeyValueObserv*, SwiftUI app-level types,
|
|
91
|
+
* Combine, RxSwift, app-named classes, anonymous closures (`<closure ...>`).
|
|
92
|
+
*
|
|
93
|
+
* The default behavior of `analyzeMemgraph` continues to return the raw
|
|
94
|
+
* `abandonedMemoryTop[]` so callers who need framework-collection counts
|
|
95
|
+
* (e.g. cache-bloat investigations) still see them. The actionable field
|
|
96
|
+
* is parallel data, not a replacement.
|
|
97
|
+
*/
|
|
98
|
+
export declare function isFrameworkNoise(className: string): boolean;
|
|
61
99
|
/**
|
|
62
100
|
* Pure: parse `leaks --referenceTree --groupByType --noContent` stdout,
|
|
63
101
|
* aggregate instance counts + bytes by class name, return the top N by
|
|
@@ -70,28 +70,211 @@ export function parseSizeBytes(raw) {
|
|
|
70
70
|
/**
|
|
71
71
|
* Pure: extract the class name from a leaks reference-tree line value.
|
|
72
72
|
*
|
|
73
|
-
* - "AVPlayerItem"
|
|
74
|
-
* - "_playerItem --> AVPlayerItemInternal"
|
|
75
|
-
* - "__strong _object --> NSKeyValueObservance"
|
|
76
|
-
* - ""
|
|
73
|
+
* - "AVPlayerItem" -> "AVPlayerItem"
|
|
74
|
+
* - "_playerItem --> AVPlayerItemInternal" -> "AVPlayerItemInternal"
|
|
75
|
+
* - "__strong _object --> NSKeyValueObservance" -> "NSKeyValueObservance"
|
|
76
|
+
* - "<CFDictionary 0x6000029c4840> [64]" -> "CFDictionary"
|
|
77
|
+
* - "<NSMutableDictionary 0x600003ccf5c0> [32]" -> "NSMutableDictionary"
|
|
78
|
+
* - "_object --> <NSObject 0x14f100> [16]" -> "NSObject"
|
|
79
|
+
* - "" -> null (caller skips)
|
|
77
80
|
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
81
|
+
* The `<ClassName 0xADDR> [size]` form is what `leaks --referenceTree` emits
|
|
82
|
+
* for arrow-targeted instances (e.g. `_object --> <NSObject 0xADDR>`).
|
|
83
|
+
* Without normalization, each address becomes its own aggregation key and
|
|
84
|
+
* the same logical class shows up as N separate rows in the top-N list.
|
|
85
|
+
* Normalizing to the base class name (the token inside the `<...>`) folds
|
|
86
|
+
* those rows back together. This is the v1.10 fix for the gap where
|
|
87
|
+
* AVPlayerItem-style classes appeared aggregated at the root level but
|
|
88
|
+
* NSMutableDictionary-style classes appeared per-address in arrow targets.
|
|
89
|
+
*
|
|
90
|
+
* Excludes c-runtime allocations like `malloc in FigSimpleMutex...` AND the
|
|
91
|
+
* bracketed form `<malloc in ...>` / `<calloc in ...>` / `<realloc in ...>`
|
|
92
|
+
* that leaks emits alongside Obj-C/Swift classes; those are not actionable
|
|
93
|
+
* for abandoned-memory triage and would inflate the top-N list with
|
|
94
|
+
* low-signal entries.
|
|
82
95
|
*/
|
|
83
96
|
export function extractClassName(rawLabel) {
|
|
84
97
|
const label = rawLabel.trim();
|
|
85
98
|
if (label.length === 0)
|
|
86
99
|
return null;
|
|
87
|
-
|
|
88
|
-
|
|
100
|
+
// Resolve `--> Target` arrows first: the class name is the value's type,
|
|
101
|
+
// not the property name that points at it. Then run the allocator + size
|
|
102
|
+
// filters against the resolved candidate so entries like
|
|
103
|
+
// `unaligned --> calloc in quic_stream_allocate` are correctly dropped.
|
|
89
104
|
const arrowIdx = label.indexOf("-->");
|
|
90
|
-
|
|
105
|
+
let candidate = arrowIdx >= 0 ? label.slice(arrowIdx + 3).trim() : label;
|
|
91
106
|
if (candidate.length === 0)
|
|
92
107
|
return null;
|
|
108
|
+
// Raw allocator entries (`malloc in ...`, `calloc in ...`) are dropped.
|
|
109
|
+
// Same for the bracketed form: `<malloc in ...>` / `<calloc in ...>`.
|
|
110
|
+
if (/^(malloc|calloc|realloc)\b/i.test(candidate))
|
|
111
|
+
return null;
|
|
112
|
+
if (/^<\s*(malloc|calloc|realloc)\b/i.test(candidate))
|
|
113
|
+
return null;
|
|
114
|
+
// Normalize `<ClassName 0xADDR> [size]` and `<ClassName 0xADDR>` to
|
|
115
|
+
// `ClassName`. The base-class name is the leading token inside `<...>`,
|
|
116
|
+
// before the first space (which separates it from the address).
|
|
117
|
+
const bracketMatch = /^<\s*([^\s<>]+)\s+0x[0-9a-fA-F]+\s*>(?:\s*\[[^\]]+\])?\s*$/.exec(candidate);
|
|
118
|
+
if (bracketMatch) {
|
|
119
|
+
candidate = bracketMatch[1];
|
|
120
|
+
}
|
|
93
121
|
return candidate;
|
|
94
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* Pure: returns true when the class name is framework-noise that crowds out
|
|
125
|
+
* actionable classes in the abandoned-memory top-N list. Used by the
|
|
126
|
+
* `analyzeMemgraph` and `analyzeAbandonedMemory` tools to populate a
|
|
127
|
+
* `*Suspects[]` / `actionable*[]` field alongside the raw `*Top[]` field.
|
|
128
|
+
*
|
|
129
|
+
* The list catalogs:
|
|
130
|
+
* - Foundation collection types (`NSMutableDictionary`, `CFString`, etc.)
|
|
131
|
+
* that grow with normal app activity and are rarely the leak itself
|
|
132
|
+
* - ObjC runtime / metadata classes (`Class.data`, `OBJC_METACLASS_$...`)
|
|
133
|
+
* - Apple system frameworks' static data sections (`__DATA __bss`,
|
|
134
|
+
* `__DATA __data`, `__DATA __common`)
|
|
135
|
+
* - `<<TOTAL>>` summary row
|
|
136
|
+
* - "Stack of thread N" and similar meta-rows
|
|
137
|
+
* - Non-object zone descriptors and memory-zone metadata
|
|
138
|
+
*
|
|
139
|
+
* Deliberately NOT noise: AV*, NSKeyValueObserv*, SwiftUI app-level types,
|
|
140
|
+
* Combine, RxSwift, app-named classes, anonymous closures (`<closure ...>`).
|
|
141
|
+
*
|
|
142
|
+
* The default behavior of `analyzeMemgraph` continues to return the raw
|
|
143
|
+
* `abandonedMemoryTop[]` so callers who need framework-collection counts
|
|
144
|
+
* (e.g. cache-bloat investigations) still see them. The actionable field
|
|
145
|
+
* is parallel data, not a replacement.
|
|
146
|
+
*/
|
|
147
|
+
export function isFrameworkNoise(className) {
|
|
148
|
+
// Summary / meta-rows
|
|
149
|
+
if (className === "<<TOTAL>>" || className === "<< TOTAL >>")
|
|
150
|
+
return true;
|
|
151
|
+
if (/^Stack of thread\b/i.test(className))
|
|
152
|
+
return true;
|
|
153
|
+
if (/^non-object\b/i.test(className))
|
|
154
|
+
return true;
|
|
155
|
+
// Memory zones / VM regions
|
|
156
|
+
if (/^VM:\s/.test(className))
|
|
157
|
+
return true;
|
|
158
|
+
if (/(DefaultMallocZone|QuartzCore_0x|MALLOC_)/.test(className))
|
|
159
|
+
return true;
|
|
160
|
+
// ObjC runtime + metadata
|
|
161
|
+
if (/^Class\.(data|methodCache)/.test(className))
|
|
162
|
+
return true;
|
|
163
|
+
if (/^OBJC_METACLASS_/.test(className))
|
|
164
|
+
return true;
|
|
165
|
+
if (/^OBJC_CLASS_/.test(className))
|
|
166
|
+
return true;
|
|
167
|
+
// Apple framework static-data sections
|
|
168
|
+
if (/__DATA\s+__(bss|data|common|objc_data|objc_const)/.test(className))
|
|
169
|
+
return true;
|
|
170
|
+
if (/__DATA_DIRTY\b/.test(className))
|
|
171
|
+
return true;
|
|
172
|
+
if (/dylib\s+__DATA/.test(className))
|
|
173
|
+
return true;
|
|
174
|
+
// Block infrastructure (closures, GCD work items)
|
|
175
|
+
if (className === "__NSMallocBlock__")
|
|
176
|
+
return true;
|
|
177
|
+
if (className === "__NSConcreteMallocBlock")
|
|
178
|
+
return true;
|
|
179
|
+
if (className === "__NSStackBlock__")
|
|
180
|
+
return true;
|
|
181
|
+
if (className === "__NSGlobalBlock__")
|
|
182
|
+
return true;
|
|
183
|
+
// Swift runtime metadata
|
|
184
|
+
if (className === "Swift Metadata")
|
|
185
|
+
return true;
|
|
186
|
+
if (/^Swift\.OpaqueExistentialContainer\b/.test(className))
|
|
187
|
+
return true;
|
|
188
|
+
// GCD infrastructure (queue + group + semaphore types accumulate naturally).
|
|
189
|
+
// No word-boundary because `dispatch_queue_t` / `dispatch_semaphore_t`
|
|
190
|
+
// continue with `_t` after the type name (no `\b` between word chars).
|
|
191
|
+
if (/^dispatch_(queue|group|semaphore|source|io)(_t)?\b/.test(className))
|
|
192
|
+
return true;
|
|
193
|
+
// C++ stdlib bookkeeping
|
|
194
|
+
if (/^std::__shared_ptr_emplace</.test(className))
|
|
195
|
+
return true;
|
|
196
|
+
if (/^std::__1::shared_ptr</.test(className))
|
|
197
|
+
return true;
|
|
198
|
+
// Foundation key/value/map collections (scale with app activity, rarely
|
|
199
|
+
// the actionable leak site)
|
|
200
|
+
if (/^NSMapTable\b/.test(className))
|
|
201
|
+
return true;
|
|
202
|
+
if (/^NSHashTable\b/.test(className))
|
|
203
|
+
return true;
|
|
204
|
+
// Bundle metadata (loads + caches grow naturally with app activity)
|
|
205
|
+
if (className === "NSBundle" || className === "CFBundle")
|
|
206
|
+
return true;
|
|
207
|
+
// Network.framework / XPC / BackBoardServices internal types
|
|
208
|
+
if (/^OS_(nw|xpc|os_lock|object)_/.test(className))
|
|
209
|
+
return true;
|
|
210
|
+
if (/^NWConcrete_/.test(className))
|
|
211
|
+
return true;
|
|
212
|
+
if (/^nw_/.test(className))
|
|
213
|
+
return true;
|
|
214
|
+
if (/^BSObjC/.test(className))
|
|
215
|
+
return true;
|
|
216
|
+
// Font cache infrastructure (CoreText)
|
|
217
|
+
if (className === "UICTFont" || className === "TTenuousComponentFont")
|
|
218
|
+
return true;
|
|
219
|
+
// Block/closure infrastructure that leaks(1) labels generically
|
|
220
|
+
if (className === "Closure context (unknown layout)")
|
|
221
|
+
return true;
|
|
222
|
+
// Array storage (Foundation/CoreFoundation backing storage)
|
|
223
|
+
if (/^NSArray\._list/.test(className))
|
|
224
|
+
return true;
|
|
225
|
+
// SwiftUI internal anonymized buffers (private namespaces ending in dollar-tagged module ids).
|
|
226
|
+
// Real app-level SwiftUI types use module-qualified names like `MyApp.MyView`;
|
|
227
|
+
// these anonymized SwiftUI internals scale with view-graph activity.
|
|
228
|
+
if (/^SwiftUI\.\(.+ in \$[0-9a-f]+\)</.test(className))
|
|
229
|
+
return true;
|
|
230
|
+
// Foundation collection types that grow with normal app activity
|
|
231
|
+
const noiseCollections = new Set([
|
|
232
|
+
"NSMutableDictionary",
|
|
233
|
+
"NSMutableDictionary (Storage)",
|
|
234
|
+
"NSDictionary",
|
|
235
|
+
"NSDictionary (Storage)",
|
|
236
|
+
"NSMutableArray",
|
|
237
|
+
"NSMutableArray (Storage)",
|
|
238
|
+
"NSArray",
|
|
239
|
+
"NSArray (Storage)",
|
|
240
|
+
"NSMutableSet",
|
|
241
|
+
"NSSet",
|
|
242
|
+
"CFString",
|
|
243
|
+
"CFString (Storage)",
|
|
244
|
+
"CFDictionary",
|
|
245
|
+
"CFDictionary (Storage)",
|
|
246
|
+
"CFDictionary (Value Storage)",
|
|
247
|
+
"CFArray",
|
|
248
|
+
"CFSet",
|
|
249
|
+
"CFSet (Value Storage)",
|
|
250
|
+
"CFData",
|
|
251
|
+
"NSData",
|
|
252
|
+
"NSConcreteMutableData",
|
|
253
|
+
"__NSCFString",
|
|
254
|
+
"__NSCFData",
|
|
255
|
+
"__NSCFDictionary",
|
|
256
|
+
"__NSCFArray",
|
|
257
|
+
"NSConcreteAttributedString",
|
|
258
|
+
]);
|
|
259
|
+
if (noiseCollections.has(className))
|
|
260
|
+
return true;
|
|
261
|
+
// Closure contexts and Swift internal storage that scale with app activity
|
|
262
|
+
if (/^Swift\._ContiguousArrayStorage</.test(className))
|
|
263
|
+
return true;
|
|
264
|
+
if (/^Swift\._SwiftDeferredNSDictionary</.test(className))
|
|
265
|
+
return true;
|
|
266
|
+
// Anonymous bracketed instances that still leaked through (extractClassName
|
|
267
|
+
// missed them, e.g. closures with no class name).
|
|
268
|
+
if (/^<[^>]*0x[0-9a-fA-F]+>/.test(className))
|
|
269
|
+
return true;
|
|
270
|
+
// Foundation observer registry internals (these grow with KVO activity but
|
|
271
|
+
// are not the actionable site; the user's class is what to fix).
|
|
272
|
+
if (className === "CFXNotificationRegistrar")
|
|
273
|
+
return true;
|
|
274
|
+
if (/^_realloc in/.test(className))
|
|
275
|
+
return true;
|
|
276
|
+
return false;
|
|
277
|
+
}
|
|
95
278
|
/**
|
|
96
279
|
* Pure: parse `leaks --referenceTree --groupByType --noContent` stdout,
|
|
97
280
|
* aggregate instance counts + bytes by class name, return the top N by
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"referenceTree.js","sourceRoot":"","sources":["../../src/parsers/referenceTree.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAQH,MAAM,OAAO;AACX,oHAAoH;AACpH,uEAAuE;AACvE,wDAAwD;AACxD,yCAAyC,CAAC;AAE5C,MAAM,IAAI,GAAG,IAAI,CAAC;AAElB;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,GAAW;IACxC,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;IAC3B,MAAM,CAAC,GAAG,2CAA2C,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACpE,IAAI,CAAC,CAAC;QAAE,OAAO,CAAC,CAAC;IACjB,MAAM,KAAK,GAAG,MAAM,CAAC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EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC,CAAC;QACzE,CAAC;IACH,CAAC;IACD,MAAM,OAAO,GAAyB,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAC5E,SAAS;QACT,aAAa,EAAE,CAAC,CAAC,aAAa;QAC9B,UAAU,EAAE,CAAC,CAAC,UAAU;KACzB,CAAC,CAAC,CAAC;IACJ,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACpB,IAAI,CAAC,CAAC,aAAa,KAAK,CAAC,CAAC,aAAa;YACrC,OAAO,CAAC,CAAC,aAAa,GAAG,CAAC,CAAC,aAAa,CAAC;QAC3C,IAAI,CAAC,CAAC,UAAU,KAAK,CAAC,CAAC,UAAU;YAAE,OAAO,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,CAAC;QACtE,OAAO,CAAC,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;IACH,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;AAChC,CAAC"}
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* agent loop without an extra round-trip.
|
|
19
19
|
*/
|
|
20
20
|
import { z } from "zod";
|
|
21
|
-
export declare const outputFormatField: z.ZodOptional<z.ZodEnum<["markdown", "json", "both"]>>;
|
|
21
|
+
export declare const outputFormatField: z.ZodOptional<z.ZodEnum<["markdown", "json", "both", "verify-fix-table"]>>;
|
|
22
22
|
export type OutputFormat = z.infer<typeof outputFormatField>;
|
|
23
23
|
export interface McpContentItem {
|
|
24
24
|
type: "text";
|
|
@@ -41,6 +41,29 @@ export interface McpResponse {
|
|
|
41
41
|
* `markdown` and `both`, the markdown is rendered via {@link renderAsMarkdown}.
|
|
42
42
|
*/
|
|
43
43
|
export declare function formatMcpResponse(result: unknown, toolName: string, format: OutputFormat | undefined): McpResponse;
|
|
44
|
+
/**
|
|
45
|
+
* Pure: render a verify-fix focused markdown table for tools that support
|
|
46
|
+
* it. Returns `null` if the tool's result does not match the expected
|
|
47
|
+
* verify-fix shape, signaling the caller to fall back to standard markdown.
|
|
48
|
+
*
|
|
49
|
+
* Supported tools:
|
|
50
|
+
*
|
|
51
|
+
* - `analyzeAbandonedMemory`: reads `actionableShrinkage[]` (the v1.10
|
|
52
|
+
* verify-fix-default direction: classes that the fix freed) and
|
|
53
|
+
* `actionableGrowth[]` (regressions the fix didn't address). Emits one
|
|
54
|
+
* table for shrinkage and, when non-empty, a second smaller table for
|
|
55
|
+
* growth. Threshold: |delta| >= 10 by default to filter cosmetic noise.
|
|
56
|
+
*
|
|
57
|
+
* - `diffMemgraphs`: reads `classCountChanges[]` (positive + negative).
|
|
58
|
+
* Future expansion; for now returns null and falls back to standard
|
|
59
|
+
* markdown.
|
|
60
|
+
*
|
|
61
|
+
* The 4-column layout is deliberately compact (Class | Before | After |
|
|
62
|
+
* Delta) so it renders cleanly in GitHub's markdown preview, dev.to, and
|
|
63
|
+
* agent chat contexts. A trailing `> Diagnosis: ...` blockquote carries
|
|
64
|
+
* the structured `diagnosis` field when present.
|
|
65
|
+
*/
|
|
66
|
+
export declare function renderVerifyFixTable(result: unknown, toolName: string): string | null;
|
|
44
67
|
/**
|
|
45
68
|
* Pure: render an arbitrary JSON-shaped value as markdown.
|
|
46
69
|
*
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
import { z } from "zod";
|
|
21
21
|
import { getRedactionMode, redact } from "./redact.js";
|
|
22
22
|
export const outputFormatField = z
|
|
23
|
-
.enum(["markdown", "json", "both"])
|
|
23
|
+
.enum(["markdown", "json", "both", "verify-fix-table"])
|
|
24
24
|
.optional()
|
|
25
|
-
.describe("Response format. Omitted or `json` (default, preserves v1.8 behavior) returns JSON.stringify of the result. `markdown` renders a human-readable view of the same data. `both` returns both content items in one response, so a client can display markdown to the user and parse JSON for the agent loop without a second call.");
|
|
25
|
+
.describe("Response format. Omitted or `json` (default, preserves v1.8 behavior) returns JSON.stringify of the result. `markdown` renders a human-readable view of the same data. `both` returns both content items in one response, so a client can display markdown to the user and parse JSON for the agent loop without a second call. `verify-fix-table` (v1.10, applies to `analyzeAbandonedMemory` and `diffMemgraphs`) emits a focused 4-column markdown comparison table (Class | Before | After | Delta) of the actionable rows; other tools fall back to `markdown` for this value.");
|
|
26
26
|
/**
|
|
27
27
|
* Pure: shape the MCP response based on the caller's `outputFormat`.
|
|
28
28
|
*
|
|
@@ -41,6 +41,18 @@ export function formatMcpResponse(result, toolName, format) {
|
|
|
41
41
|
if (mode === "json") {
|
|
42
42
|
return { content: [{ type: "text", text: json }] };
|
|
43
43
|
}
|
|
44
|
+
// `verify-fix-table` is a focused renderer that takes precedence over
|
|
45
|
+
// the generic markdown one. Falls back to standard markdown when the
|
|
46
|
+
// tool does not implement a verify-fix view.
|
|
47
|
+
if (mode === "verify-fix-table") {
|
|
48
|
+
const focused = renderVerifyFixTable(redacted, toolName);
|
|
49
|
+
if (focused != null) {
|
|
50
|
+
return { content: [{ type: "text", text: focused }] };
|
|
51
|
+
}
|
|
52
|
+
// Fall through to markdown for tools that don't implement it.
|
|
53
|
+
const fallback = renderAsMarkdown(redacted, toolName);
|
|
54
|
+
return { content: [{ type: "text", text: fallback }] };
|
|
55
|
+
}
|
|
44
56
|
const markdown = renderAsMarkdown(redacted, toolName);
|
|
45
57
|
if (mode === "markdown") {
|
|
46
58
|
return { content: [{ type: "text", text: markdown }] };
|
|
@@ -55,6 +67,101 @@ export function formatMcpResponse(result, toolName, format) {
|
|
|
55
67
|
],
|
|
56
68
|
};
|
|
57
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* Pure: render a verify-fix focused markdown table for tools that support
|
|
72
|
+
* it. Returns `null` if the tool's result does not match the expected
|
|
73
|
+
* verify-fix shape, signaling the caller to fall back to standard markdown.
|
|
74
|
+
*
|
|
75
|
+
* Supported tools:
|
|
76
|
+
*
|
|
77
|
+
* - `analyzeAbandonedMemory`: reads `actionableShrinkage[]` (the v1.10
|
|
78
|
+
* verify-fix-default direction: classes that the fix freed) and
|
|
79
|
+
* `actionableGrowth[]` (regressions the fix didn't address). Emits one
|
|
80
|
+
* table for shrinkage and, when non-empty, a second smaller table for
|
|
81
|
+
* growth. Threshold: |delta| >= 10 by default to filter cosmetic noise.
|
|
82
|
+
*
|
|
83
|
+
* - `diffMemgraphs`: reads `classCountChanges[]` (positive + negative).
|
|
84
|
+
* Future expansion; for now returns null and falls back to standard
|
|
85
|
+
* markdown.
|
|
86
|
+
*
|
|
87
|
+
* The 4-column layout is deliberately compact (Class | Before | After |
|
|
88
|
+
* Delta) so it renders cleanly in GitHub's markdown preview, dev.to, and
|
|
89
|
+
* agent chat contexts. A trailing `> Diagnosis: ...` blockquote carries
|
|
90
|
+
* the structured `diagnosis` field when present.
|
|
91
|
+
*/
|
|
92
|
+
export function renderVerifyFixTable(result, toolName) {
|
|
93
|
+
if (toolName !== "analyzeAbandonedMemory") {
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
if (result == null || typeof result !== "object") {
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
const obj = result;
|
|
100
|
+
const shrinkage = extractVerifyFixRows(obj["actionableShrinkage"]);
|
|
101
|
+
const growth = extractVerifyFixRows(obj["actionableGrowth"]);
|
|
102
|
+
const diagnosis = typeof obj["diagnosis"] === "string" ? obj["diagnosis"] : null;
|
|
103
|
+
// Threshold: filter cosmetic noise.
|
|
104
|
+
const DELTA_THRESHOLD = 10;
|
|
105
|
+
const filteredShrinkage = shrinkage.filter((r) => Math.abs(r.delta) >= DELTA_THRESHOLD);
|
|
106
|
+
const filteredGrowth = growth.filter((r) => Math.abs(r.delta) >= DELTA_THRESHOLD);
|
|
107
|
+
if (filteredShrinkage.length === 0 && filteredGrowth.length === 0) {
|
|
108
|
+
return [
|
|
109
|
+
"# analyzeAbandonedMemory: verify-fix",
|
|
110
|
+
"",
|
|
111
|
+
"_No class counts crossed the actionable threshold (|delta| >= 10)._",
|
|
112
|
+
diagnosis ? `\n> ${diagnosis}` : "",
|
|
113
|
+
]
|
|
114
|
+
.join("\n")
|
|
115
|
+
.trim();
|
|
116
|
+
}
|
|
117
|
+
const sections = ["# analyzeAbandonedMemory: verify-fix", ""];
|
|
118
|
+
if (filteredShrinkage.length > 0) {
|
|
119
|
+
sections.push("## What the fix freed");
|
|
120
|
+
sections.push("");
|
|
121
|
+
sections.push("| Class | Before | After | Delta |");
|
|
122
|
+
sections.push("|---|---:|---:|---:|");
|
|
123
|
+
for (const row of filteredShrinkage) {
|
|
124
|
+
sections.push(`| \`${row.className}\` | ${row.beforeCount} | ${row.afterCount} | ${row.delta} |`);
|
|
125
|
+
}
|
|
126
|
+
sections.push("");
|
|
127
|
+
}
|
|
128
|
+
if (filteredGrowth.length > 0) {
|
|
129
|
+
sections.push("## Classes that grew (regressions or unrelated)");
|
|
130
|
+
sections.push("");
|
|
131
|
+
sections.push("| Class | Before | After | Delta |");
|
|
132
|
+
sections.push("|---|---:|---:|---:|");
|
|
133
|
+
for (const row of filteredGrowth) {
|
|
134
|
+
sections.push(`| \`${row.className}\` | ${row.beforeCount} | ${row.afterCount} | +${row.delta} |`);
|
|
135
|
+
}
|
|
136
|
+
sections.push("");
|
|
137
|
+
}
|
|
138
|
+
if (diagnosis) {
|
|
139
|
+
sections.push(`> ${diagnosis}`);
|
|
140
|
+
}
|
|
141
|
+
return sections.join("\n").trim();
|
|
142
|
+
}
|
|
143
|
+
function extractVerifyFixRows(value) {
|
|
144
|
+
if (!Array.isArray(value))
|
|
145
|
+
return [];
|
|
146
|
+
const rows = [];
|
|
147
|
+
for (const item of value) {
|
|
148
|
+
if (item == null || typeof item !== "object")
|
|
149
|
+
continue;
|
|
150
|
+
const r = item;
|
|
151
|
+
if (typeof r["className"] === "string" &&
|
|
152
|
+
typeof r["beforeCount"] === "number" &&
|
|
153
|
+
typeof r["afterCount"] === "number" &&
|
|
154
|
+
typeof r["delta"] === "number") {
|
|
155
|
+
rows.push({
|
|
156
|
+
className: r["className"],
|
|
157
|
+
beforeCount: r["beforeCount"],
|
|
158
|
+
afterCount: r["afterCount"],
|
|
159
|
+
delta: r["delta"],
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return rows;
|
|
164
|
+
}
|
|
58
165
|
/**
|
|
59
166
|
* Pure: render an arbitrary JSON-shaped value as markdown.
|
|
60
167
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"responseFormatter.js","sourceRoot":"","sources":["../../src/runtime/responseFormatter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAEvD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC;KAC/B,IAAI,CAAC,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"responseFormatter.js","sourceRoot":"","sources":["../../src/runtime/responseFormatter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAEvD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC;KAC/B,IAAI,CAAC,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB,CAAC,CAAC;KACtD,QAAQ,EAAE;KACV,QAAQ,CACP,qjBAAqjB,CACtjB,CAAC;AAoBJ;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAC/B,MAAe,EACf,QAAgB,EAChB,MAAgC;IAEhC,MA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AE,CAAC,CAAC;gBAAE,IAAI,IAAI,CAAC,CAAC;QAC5D,CAAC;QACD,OAAO,IAAI,IAAI,SAAS,CAAC;IAC3B,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -29,24 +29,24 @@ export declare const analyzeAbandonedMemoryShape: {
|
|
|
29
29
|
readonly afterPath: z.ZodString;
|
|
30
30
|
readonly topN: z.ZodDefault<z.ZodNumber>;
|
|
31
31
|
readonly classFilter: z.ZodOptional<z.ZodString>;
|
|
32
|
-
readonly outputFormat: z.ZodOptional<z.ZodEnum<["markdown", "json", "both"]>>;
|
|
32
|
+
readonly outputFormat: z.ZodOptional<z.ZodEnum<["markdown", "json", "both", "verify-fix-table"]>>;
|
|
33
33
|
};
|
|
34
34
|
export declare const analyzeAbandonedMemorySchema: z.ZodObject<{
|
|
35
35
|
readonly beforePath: z.ZodString;
|
|
36
36
|
readonly afterPath: z.ZodString;
|
|
37
37
|
readonly topN: z.ZodDefault<z.ZodNumber>;
|
|
38
38
|
readonly classFilter: z.ZodOptional<z.ZodString>;
|
|
39
|
-
readonly outputFormat: z.ZodOptional<z.ZodEnum<["markdown", "json", "both"]>>;
|
|
39
|
+
readonly outputFormat: z.ZodOptional<z.ZodEnum<["markdown", "json", "both", "verify-fix-table"]>>;
|
|
40
40
|
}, "strip", z.ZodTypeAny, {
|
|
41
41
|
topN: number;
|
|
42
42
|
beforePath: string;
|
|
43
43
|
afterPath: string;
|
|
44
|
-
outputFormat?: "markdown" | "json" | "both" | undefined;
|
|
44
|
+
outputFormat?: "markdown" | "json" | "both" | "verify-fix-table" | undefined;
|
|
45
45
|
classFilter?: string | undefined;
|
|
46
46
|
}, {
|
|
47
47
|
beforePath: string;
|
|
48
48
|
afterPath: string;
|
|
49
|
-
outputFormat?: "markdown" | "json" | "both" | undefined;
|
|
49
|
+
outputFormat?: "markdown" | "json" | "both" | "verify-fix-table" | undefined;
|
|
50
50
|
topN?: number | undefined;
|
|
51
51
|
classFilter?: string | undefined;
|
|
52
52
|
}>;
|
|
@@ -80,14 +80,36 @@ export interface AnalyzeAbandonedMemoryResult {
|
|
|
80
80
|
* descending. Each entry carries a `classification` from the catalog plus
|
|
81
81
|
* a `confidence` tier. The agent can branch on `classification` to choose
|
|
82
82
|
* the right `swiftSearchPattern` / fix template.
|
|
83
|
+
*
|
|
84
|
+
* **Raw view.** Includes framework noise (NSMutableDictionary, CFString,
|
|
85
|
+
* libMainThreadChecker bss, etc.). Useful for cache-bloat investigations.
|
|
83
86
|
*/
|
|
84
87
|
growthByClass: AbandonedMemoryEntry[];
|
|
85
88
|
/**
|
|
86
89
|
* Classes that shrunk between before and after. Surfaced so the caller
|
|
87
90
|
* can confirm the fix freed the suspect class (e.g. AVPlayerItem in the
|
|
88
91
|
* notelet case went from 342 to 0). Sorted by absolute delta desc.
|
|
92
|
+
*
|
|
93
|
+
* **Raw view.** See `actionableShrinkage` for the filtered "what fix
|
|
94
|
+
* verifiably freed" view.
|
|
89
95
|
*/
|
|
90
96
|
shrinkageByClass: AbandonedMemoryEntry[];
|
|
97
|
+
/**
|
|
98
|
+
* `growthByClass` with framework noise filtered out (Foundation collection
|
|
99
|
+
* types, ObjC metadata, __DATA sections, allocator stacks, etc.). The
|
|
100
|
+
* remaining entries are user-actionable classes. New in v1.10.
|
|
101
|
+
*
|
|
102
|
+
* Use this when answering "what new bug just appeared?". Use the raw
|
|
103
|
+
* `growthByClass` when answering "what does the heap look like now?".
|
|
104
|
+
*/
|
|
105
|
+
actionableGrowth: AbandonedMemoryEntry[];
|
|
106
|
+
/**
|
|
107
|
+
* `shrinkageByClass` with framework noise filtered out. Use this in the
|
|
108
|
+
* verify-fix loop to confirm which app-level classes the fix actually
|
|
109
|
+
* freed. AVPlayerItem dropping from 342 to 0 shows up here at the top.
|
|
110
|
+
* New in v1.10.
|
|
111
|
+
*/
|
|
112
|
+
actionableShrinkage: AbandonedMemoryEntry[];
|
|
91
113
|
/** Plain-English diagnosis tying the highest-confidence growth to a fix hint. */
|
|
92
114
|
diagnosis: string;
|
|
93
115
|
/** Pipeline hints: chain into `swiftSearchPattern` against the top growth class. */
|
|
@@ -25,7 +25,7 @@ import { z } from "zod";
|
|
|
25
25
|
import { existsSync } from "node:fs";
|
|
26
26
|
import { resolve as resolvePath } from "node:path";
|
|
27
27
|
import { runCommand } from "../runtime/exec.js";
|
|
28
|
-
import { parseReferenceTreeText, } from "../parsers/referenceTree.js";
|
|
28
|
+
import { parseReferenceTreeText, isFrameworkNoise, } from "../parsers/referenceTree.js";
|
|
29
29
|
import { outputFormatField } from "../runtime/responseFormatter.js";
|
|
30
30
|
export const analyzeAbandonedMemoryShape = {
|
|
31
31
|
beforePath: z
|
|
@@ -137,10 +137,23 @@ export function buildAbandonedMemoryDiff(before, after, options) {
|
|
|
137
137
|
};
|
|
138
138
|
const diagnosis = buildDiagnosis(growthByClass, shrinkageByClass);
|
|
139
139
|
const suggestedNextCalls = buildSuggestedNextCalls(growthByClass);
|
|
140
|
+
// Actionable views: drop framework noise so the caller's first-look list
|
|
141
|
+
// surfaces app-level + AV + KVO classes instead of NSMutableDictionary +
|
|
142
|
+
// CFString + ObjC runtime data. Same ranking, just filtered. Falls back
|
|
143
|
+
// to topN, so the actionable list can be SHORTER than the raw view when
|
|
144
|
+
// most of the top entries are noise.
|
|
145
|
+
const actionableGrowth = growthByClass
|
|
146
|
+
.filter((e) => !isFrameworkNoise(e.className))
|
|
147
|
+
.slice(0, options.topN);
|
|
148
|
+
const actionableShrinkage = shrinkageByClass
|
|
149
|
+
.filter((e) => !isFrameworkNoise(e.className))
|
|
150
|
+
.slice(0, options.topN);
|
|
140
151
|
return {
|
|
141
152
|
totals,
|
|
142
153
|
growthByClass: growthByClass.slice(0, options.topN),
|
|
143
154
|
shrinkageByClass: shrinkageByClass.slice(0, options.topN),
|
|
155
|
+
actionableGrowth,
|
|
156
|
+
actionableShrinkage,
|
|
144
157
|
diagnosis,
|
|
145
158
|
...(suggestedNextCalls.length > 0 ? { suggestedNextCalls } : {}),
|
|
146
159
|
};
|
|
@@ -181,13 +194,38 @@ export function classifyGrowth(className, delta, hasKvoCoOccurrence, kvoObservan
|
|
|
181
194
|
hint: "NSKeyValueObservance growth indicates `observe(\\.x) { ... }` tokens that were never invalidated. The token strongly retains the change closure (which usually captures self), and the closure is anchored in the KVO global observer registry. Use `[weak self]` inside the observe closure and call `token?.invalidate()` in `deinit`, or invalidate-then-nil before reassigning the token. See `classifyCycle` pattern `kvo.observation-not-invalidated`.",
|
|
182
195
|
};
|
|
183
196
|
}
|
|
197
|
+
// KVO co-occurrence escalation. Tightened in v1.10 after the v1.9 retro
|
|
198
|
+
// showed the broad `delta >= 5` rule was painting 25 unrelated classes
|
|
199
|
+
// as `kvo-observer-orphaned high` whenever NSKeyValueObservance grew at
|
|
200
|
+
// all. Three guards now:
|
|
201
|
+
// 1. Skip classes that look like framework noise (allocator stacks,
|
|
202
|
+
// memory zones, __DATA sections, summary rows, etc.)
|
|
203
|
+
// 2. Skip classes that are not "object-shaped" (anonymous bracket
|
|
204
|
+
// forms `<... 0xADDR> [size]`, byte-offset prefixes, etc.). These
|
|
205
|
+
// slip past Phase A's extractClassName when the leaks output uses
|
|
206
|
+
// a non-canonical form for them.
|
|
207
|
+
// 3. Require the candidate's delta to be a meaningful FRACTION of
|
|
208
|
+
// the KVO growth, not just any positive delta. A class with
|
|
209
|
+
// delta=5 when NSKeyValueObservance grew by +200 is statistical
|
|
210
|
+
// noise; the proportion thresholds below capture this.
|
|
184
211
|
if (hasKvoCoOccurrence && delta >= 5) {
|
|
185
|
-
const
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
212
|
+
const isObjectShaped = !isFrameworkNoise(className) &&
|
|
213
|
+
!/^<.*0x[0-9a-fA-F]+.*>/.test(className) &&
|
|
214
|
+
!/^\d+ bytes into\b/.test(className);
|
|
215
|
+
// Proportional thresholds. A class whose delta is below half of the
|
|
216
|
+
// NSKeyValueObservance delta is rejected as too small to be the
|
|
217
|
+
// observed type. Above 5x the KVO delta the confidence escalates
|
|
218
|
+
// to high (the class is the dominant observed type by a wide margin).
|
|
219
|
+
const mediumThreshold = Math.max(5, Math.floor(kvoObservanceDelta * 0.5));
|
|
220
|
+
const highThreshold = Math.max(50, Math.floor(kvoObservanceDelta * 5));
|
|
221
|
+
if (isObjectShaped && delta >= mediumThreshold) {
|
|
222
|
+
const confidence = delta >= highThreshold ? "high" : "medium";
|
|
223
|
+
return {
|
|
224
|
+
classification: "kvo-observer-orphaned",
|
|
225
|
+
confidence,
|
|
226
|
+
hint: `Co-occurring NSKeyValueObservance growth (+${kvoObservanceDelta}) suggests this type is the value being observed via \`observe(\\.x) { ... }\`. The orphaned observer holds the value alive. Fixing the observer (\`token.invalidate()\` on teardown) will free this class too. See \`classifyCycle\` pattern \`kvo.observation-not-invalidated\`.`,
|
|
227
|
+
};
|
|
228
|
+
}
|
|
191
229
|
}
|
|
192
230
|
if (/^NS(Cache|CountedSet|MapTable|MutableArray|MutableDictionary|MutableSet|HashTable)/.test(className)) {
|
|
193
231
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analyzeAbandonedMemory.js","sourceRoot":"","sources":["../../src/tools/analyzeAbandonedMemory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EACL,sBAAsB,GAEvB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAEpE,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,UAAU,EAAE,CAAC;SACV,MAAM,EAAE;SACR,GAAG,CAAC,C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CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACjE,CAAC,CAAC;IAEH,OAAO;QACL,EAAE,EAAE,IAAI;QACR,UAAU;QACV,SAAS;QACT,GAAG,IAAI;KACR,CAAC;AACJ,CAAC"}
|
|
1
|
+
{"version":3,"file":"analyzeAbandonedMemory.js","sourceRoot":"","sources":["../../src/tools/analyzeAbandonedMemory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EACL,sBAAsB,EACtB,gBAAgB,GAEjB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAEpE,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,UAAU,EAAE,CAAC;SACV,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CACP,kKAAkK,CACnK;IACH,SAAS,EAAE,CAAC;SACT,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CACP,kIAAkI,CACnI;IACH,IAAI,EAAE,CAAC;SACJ,MAAM,EAAE;SACR,GAAG,EAAE;SACL,QAAQ,EAAE;SACV,GAAG,CAAC,GAAG,CAAC;SACR,OAAO,CAAC,EAAE,CAAC;SACX,QAAQ,CACP,uHAAuH,CACxH;IACH,WAAW,EAAE,CAAC;SACX,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,iNAAiN,CAClN;IACH,YAAY,EAAE,iBAAiB;CACvB,CAAC;AAE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odEnum<["markdown", "json", "both"]>>;
|
|
7
|
+
outputFormat: z.ZodOptional<z.ZodEnum<["markdown", "json", "both", "verify-fix-table"]>>;
|
|
8
8
|
}, "strip", z.ZodTypeAny, {
|
|
9
9
|
tracePath: string;
|
|
10
10
|
topN: number;
|
|
11
11
|
minBytes: number;
|
|
12
|
-
outputFormat?: "markdown" | "json" | "both" | undefined;
|
|
12
|
+
outputFormat?: "markdown" | "json" | "both" | "verify-fix-table" | undefined;
|
|
13
13
|
}, {
|
|
14
14
|
tracePath: string;
|
|
15
|
-
outputFormat?: "markdown" | "json" | "both" | undefined;
|
|
15
|
+
outputFormat?: "markdown" | "json" | "both" | "verify-fix-table" | undefined;
|
|
16
16
|
topN?: number | undefined;
|
|
17
17
|
minBytes?: number | undefined;
|
|
18
18
|
}>;
|
|
@@ -14,19 +14,19 @@ export declare const analyzeAnimationHitchesSchema: z.ZodObject<{
|
|
|
14
14
|
startMs: number;
|
|
15
15
|
endMs: number;
|
|
16
16
|
}>>;
|
|
17
|
-
outputFormat: z.ZodOptional<z.ZodEnum<["markdown", "json", "both"]>>;
|
|
17
|
+
outputFormat: z.ZodOptional<z.ZodEnum<["markdown", "json", "both", "verify-fix-table"]>>;
|
|
18
18
|
}, "strip", z.ZodTypeAny, {
|
|
19
19
|
tracePath: string;
|
|
20
20
|
topN: number;
|
|
21
21
|
minDurationMs: number;
|
|
22
|
-
outputFormat?: "markdown" | "json" | "both" | undefined;
|
|
22
|
+
outputFormat?: "markdown" | "json" | "both" | "verify-fix-table" | undefined;
|
|
23
23
|
timeRangeMs?: {
|
|
24
24
|
startMs: number;
|
|
25
25
|
endMs: number;
|
|
26
26
|
} | undefined;
|
|
27
27
|
}, {
|
|
28
28
|
tracePath: string;
|
|
29
|
-
outputFormat?: "markdown" | "json" | "both" | undefined;
|
|
29
|
+
outputFormat?: "markdown" | "json" | "both" | "verify-fix-table" | undefined;
|
|
30
30
|
topN?: number | undefined;
|
|
31
31
|
minDurationMs?: number | undefined;
|
|
32
32
|
timeRangeMs?: {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export declare const analyzeAppLaunchSchema: z.ZodObject<{
|
|
3
3
|
tracePath: z.ZodString;
|
|
4
|
-
outputFormat: z.ZodOptional<z.ZodEnum<["markdown", "json", "both"]>>;
|
|
4
|
+
outputFormat: z.ZodOptional<z.ZodEnum<["markdown", "json", "both", "verify-fix-table"]>>;
|
|
5
5
|
}, "strip", z.ZodTypeAny, {
|
|
6
6
|
tracePath: string;
|
|
7
|
-
outputFormat?: "markdown" | "json" | "both" | undefined;
|
|
7
|
+
outputFormat?: "markdown" | "json" | "both" | "verify-fix-table" | undefined;
|
|
8
8
|
}, {
|
|
9
9
|
tracePath: string;
|
|
10
|
-
outputFormat?: "markdown" | "json" | "both" | undefined;
|
|
10
|
+
outputFormat?: "markdown" | "json" | "both" | "verify-fix-table" | undefined;
|
|
11
11
|
}>;
|
|
12
12
|
export type AnalyzeAppLaunchInput = z.infer<typeof analyzeAppLaunchSchema>;
|
|
13
13
|
export interface PhaseEntry {
|
|
@@ -15,12 +15,12 @@ export declare const analyzeHangsSchema: z.ZodObject<{
|
|
|
15
15
|
endMs: number;
|
|
16
16
|
}>>;
|
|
17
17
|
topFramesByHangStartNs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
18
|
-
outputFormat: z.ZodOptional<z.ZodEnum<["markdown", "json", "both"]>>;
|
|
18
|
+
outputFormat: z.ZodOptional<z.ZodEnum<["markdown", "json", "both", "verify-fix-table"]>>;
|
|
19
19
|
}, "strip", z.ZodTypeAny, {
|
|
20
20
|
tracePath: string;
|
|
21
21
|
topN: number;
|
|
22
22
|
minDurationMs: number;
|
|
23
|
-
outputFormat?: "markdown" | "json" | "both" | undefined;
|
|
23
|
+
outputFormat?: "markdown" | "json" | "both" | "verify-fix-table" | undefined;
|
|
24
24
|
timeRangeMs?: {
|
|
25
25
|
startMs: number;
|
|
26
26
|
endMs: number;
|
|
@@ -28,7 +28,7 @@ export declare const analyzeHangsSchema: z.ZodObject<{
|
|
|
28
28
|
topFramesByHangStartNs?: Record<string, string> | undefined;
|
|
29
29
|
}, {
|
|
30
30
|
tracePath: string;
|
|
31
|
-
outputFormat?: "markdown" | "json" | "both" | undefined;
|
|
31
|
+
outputFormat?: "markdown" | "json" | "both" | "verify-fix-table" | undefined;
|
|
32
32
|
topN?: number | undefined;
|
|
33
33
|
minDurationMs?: number | undefined;
|
|
34
34
|
timeRangeMs?: {
|
|
@@ -8,21 +8,21 @@ export declare const analyzeMemgraphSchema: z.ZodObject<{
|
|
|
8
8
|
verbosity: z.ZodDefault<z.ZodEnum<["compact", "normal", "full"]>>;
|
|
9
9
|
maxClassesInChain: z.ZodDefault<z.ZodNumber>;
|
|
10
10
|
referenceTreeTopN: z.ZodDefault<z.ZodNumber>;
|
|
11
|
-
outputFormat: z.ZodOptional<z.ZodEnum<["markdown", "json", "both"]>>;
|
|
11
|
+
outputFormat: z.ZodOptional<z.ZodEnum<["markdown", "json", "both", "verify-fix-table"]>>;
|
|
12
12
|
}, "strip", z.ZodTypeAny, {
|
|
13
13
|
path: string;
|
|
14
14
|
fullChains: boolean;
|
|
15
15
|
verbosity: "compact" | "normal" | "full";
|
|
16
16
|
maxClassesInChain: number;
|
|
17
17
|
referenceTreeTopN: number;
|
|
18
|
-
outputFormat?: "markdown" | "json" | "both" | undefined;
|
|
18
|
+
outputFormat?: "markdown" | "json" | "both" | "verify-fix-table" | undefined;
|
|
19
19
|
}, {
|
|
20
20
|
path: string;
|
|
21
21
|
fullChains?: boolean | undefined;
|
|
22
22
|
verbosity?: "compact" | "normal" | "full" | undefined;
|
|
23
23
|
maxClassesInChain?: number | undefined;
|
|
24
24
|
referenceTreeTopN?: number | undefined;
|
|
25
|
-
outputFormat?: "markdown" | "json" | "both" | undefined;
|
|
25
|
+
outputFormat?: "markdown" | "json" | "both" | "verify-fix-table" | undefined;
|
|
26
26
|
}>;
|
|
27
27
|
export type AnalyzeMemgraphInput = z.infer<typeof analyzeMemgraphSchema>;
|
|
28
28
|
export interface CycleSummary {
|
|
@@ -77,8 +77,27 @@ export interface AnalyzeMemgraphResult {
|
|
|
77
77
|
* not formal leaks; they are reachable-but-suspicious and worth diffing
|
|
78
78
|
* against a baseline via `analyzeAbandonedMemory(before, after)` for
|
|
79
79
|
* the verdict.
|
|
80
|
+
*
|
|
81
|
+
* **Raw view.** Includes framework noise (NSMutableDictionary, CFString,
|
|
82
|
+
* libMainThreadChecker bss, etc.) that grows with normal app activity
|
|
83
|
+
* and is rarely the actionable leak. Useful for cache-bloat or
|
|
84
|
+
* collection-explosion investigations.
|
|
80
85
|
*/
|
|
81
86
|
abandonedMemoryTop?: ReferenceTreeEntry[];
|
|
87
|
+
/**
|
|
88
|
+
* Same top-N reference-tree analysis as `abandonedMemoryTop` but filtered
|
|
89
|
+
* to actionable classes only. Foundation collection types (NSMutableDictionary,
|
|
90
|
+
* CFString, ...), ObjC runtime metadata (Class.data, OBJC_METACLASS_),
|
|
91
|
+
* Apple-framework static-data sections (__DATA __bss / __data / __common),
|
|
92
|
+
* Stack of thread / non-object / VM region rows, and the `<<TOTAL>>`
|
|
93
|
+
* summary are all excluded. The remaining list surfaces AV*, KVO*,
|
|
94
|
+
* SwiftUI app-level types, user-named classes, and other classes the
|
|
95
|
+
* fix would actually live in. New in v1.10.
|
|
96
|
+
*
|
|
97
|
+
* Use this list for the "what should I worry about?" question; use
|
|
98
|
+
* `abandonedMemoryTop` for "what's the full heap distribution?".
|
|
99
|
+
*/
|
|
100
|
+
abandonedMemorySuspects?: ReferenceTreeEntry[];
|
|
82
101
|
}
|
|
83
102
|
/**
|
|
84
103
|
* Pure function: take a `leaks` stdout string and a source path, produce a structured analysis.
|
|
@@ -3,7 +3,7 @@ import { existsSync } from "node:fs";
|
|
|
3
3
|
import { resolve as resolvePath } from "node:path";
|
|
4
4
|
import { runCommand } from "../runtime/exec.js";
|
|
5
5
|
import { parseLeaksOutput, rootCyclesOnly } from "../parsers/leaksOutput.js";
|
|
6
|
-
import { parseReferenceTreeText, } from "../parsers/referenceTree.js";
|
|
6
|
+
import { parseReferenceTreeText, isFrameworkNoise, } from "../parsers/referenceTree.js";
|
|
7
7
|
import { outputFormatField } from "../runtime/responseFormatter.js";
|
|
8
8
|
import { shortenForVerbosity, } from "../parsers/shortenClassName.js";
|
|
9
9
|
import { suggestionClassifyCycle, suggestionReachableFromCycle, } from "../runtime/suggestions.js";
|
|
@@ -151,9 +151,23 @@ export async function analyzeMemgraph(input) {
|
|
|
151
151
|
// a workflow.
|
|
152
152
|
const topN = input.referenceTreeTopN ?? 20;
|
|
153
153
|
if (summary.totals.leakCount === 0 && topN > 0) {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
154
|
+
// Capture a much larger pool than `topN` so that after filtering for
|
|
155
|
+
// the actionable view (`abandonedMemorySuspects`), we still have enough
|
|
156
|
+
// entries to surface the user-relevant classes that would otherwise
|
|
157
|
+
// be ranked below framework noise in the raw view. The notelet
|
|
158
|
+
// investigation showed AVPlayerItem at raw rank ~82 in a ~200-class
|
|
159
|
+
// heap; 10x of a 20-element default reliably surfaces classes ranked
|
|
160
|
+
// outside the raw top 20 after the noise filter trims the leaders.
|
|
161
|
+
const captureTopN = Math.max(topN, topN * 10, 200);
|
|
162
|
+
const rawTop = await captureReferenceTreeTop(path, captureTopN);
|
|
163
|
+
if (rawTop.length > 0) {
|
|
164
|
+
// Raw view: first `topN` entries unchanged from existing behavior.
|
|
165
|
+
summary.abandonedMemoryTop = rawTop.slice(0, topN);
|
|
166
|
+
// Filtered view: drop framework noise, keep ranking, then trim to topN.
|
|
167
|
+
const filtered = rawTop.filter((e) => !isFrameworkNoise(e.className));
|
|
168
|
+
if (filtered.length > 0) {
|
|
169
|
+
summary.abandonedMemorySuspects = filtered.slice(0, topN);
|
|
170
|
+
}
|
|
157
171
|
}
|
|
158
172
|
}
|
|
159
173
|
return summary;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analyzeMemgraph.js","sourceRoot":"","sources":["../../src/tools/analyzeMemgraph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC7E,OAAO,EACL,sBAAsB,
|
|
1
|
+
{"version":3,"file":"analyzeMemgraph.js","sourceRoot":"","sources":["../../src/tools/analyzeMemgraph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC7E,OAAO,EACL,sBAAsB,EACtB,gBAAgB,GAEjB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EACL,mBAAmB,GAEpB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,uBAAuB,EACvB,4BAA4B,GAC7B,MAAM,2BAA2B,CAAC;AAGnC,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,IAAI,EAAE,CAAC;SACJ,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CACP,gFAAgF,CACjF;IACH,UAAU,EAAE,CAAC;SACV,OAAO,EAAE;SACT,OAAO,CAAC,KAAK,CAAC;SACd,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TimeProfileSchema: z.ZodObject<{
|
|
4
4
|
tracePath: z.ZodString;
|
|
5
5
|
topN: z.ZodDefault<z.ZodNumber>;
|
|
6
|
-
outputFormat: z.ZodOptional<z.ZodEnum<["markdown", "json", "both"]>>;
|
|
6
|
+
outputFormat: z.ZodOptional<z.ZodEnum<["markdown", "json", "both", "verify-fix-table"]>>;
|
|
7
7
|
}, "strip", z.ZodTypeAny, {
|
|
8
8
|
tracePath: string;
|
|
9
9
|
topN: number;
|
|
10
|
-
outputFormat?: "markdown" | "json" | "both" | undefined;
|
|
10
|
+
outputFormat?: "markdown" | "json" | "both" | "verify-fix-table" | undefined;
|
|
11
11
|
}, {
|
|
12
12
|
tracePath: string;
|
|
13
|
-
outputFormat?: "markdown" | "json" | "both" | undefined;
|
|
13
|
+
outputFormat?: "markdown" | "json" | "both" | "verify-fix-table" | undefined;
|
|
14
14
|
topN?: number | undefined;
|
|
15
15
|
}>;
|
|
16
16
|
export type AnalyzeTimeProfileInput = z.infer<typeof analyzeTimeProfileSchema>;
|
|
@@ -37,20 +37,20 @@ export declare const cleanupTracesShape: {
|
|
|
37
37
|
readonly olderThanDays: z.ZodOptional<z.ZodNumber>;
|
|
38
38
|
readonly dryRun: z.ZodDefault<z.ZodBoolean>;
|
|
39
39
|
readonly root: z.ZodOptional<z.ZodString>;
|
|
40
|
-
readonly outputFormat: z.ZodOptional<z.ZodEnum<["markdown", "json", "both"]>>;
|
|
40
|
+
readonly outputFormat: z.ZodOptional<z.ZodEnum<["markdown", "json", "both", "verify-fix-table"]>>;
|
|
41
41
|
};
|
|
42
42
|
export declare const cleanupTracesSchema: z.ZodObject<{
|
|
43
43
|
readonly olderThanDays: z.ZodOptional<z.ZodNumber>;
|
|
44
44
|
readonly dryRun: z.ZodDefault<z.ZodBoolean>;
|
|
45
45
|
readonly root: z.ZodOptional<z.ZodString>;
|
|
46
|
-
readonly outputFormat: z.ZodOptional<z.ZodEnum<["markdown", "json", "both"]>>;
|
|
46
|
+
readonly outputFormat: z.ZodOptional<z.ZodEnum<["markdown", "json", "both", "verify-fix-table"]>>;
|
|
47
47
|
}, "strip", z.ZodTypeAny, {
|
|
48
48
|
dryRun: boolean;
|
|
49
|
-
outputFormat?: "markdown" | "json" | "both" | undefined;
|
|
49
|
+
outputFormat?: "markdown" | "json" | "both" | "verify-fix-table" | undefined;
|
|
50
50
|
olderThanDays?: number | undefined;
|
|
51
51
|
root?: string | undefined;
|
|
52
52
|
}, {
|
|
53
|
-
outputFormat?: "markdown" | "json" | "both" | undefined;
|
|
53
|
+
outputFormat?: "markdown" | "json" | "both" | "verify-fix-table" | undefined;
|
|
54
54
|
olderThanDays?: number | undefined;
|
|
55
55
|
dryRun?: boolean | undefined;
|
|
56
56
|
root?: string | undefined;
|
|
@@ -3,15 +3,15 @@ import type { LeaksReport } from "../types.js";
|
|
|
3
3
|
export declare const diffMemgraphsSchema: z.ZodObject<{
|
|
4
4
|
before: z.ZodString;
|
|
5
5
|
after: z.ZodString;
|
|
6
|
-
outputFormat: z.ZodOptional<z.ZodEnum<["markdown", "json", "both"]>>;
|
|
6
|
+
outputFormat: z.ZodOptional<z.ZodEnum<["markdown", "json", "both", "verify-fix-table"]>>;
|
|
7
7
|
}, "strip", z.ZodTypeAny, {
|
|
8
8
|
after: string;
|
|
9
9
|
before: string;
|
|
10
|
-
outputFormat?: "markdown" | "json" | "both" | undefined;
|
|
10
|
+
outputFormat?: "markdown" | "json" | "both" | "verify-fix-table" | undefined;
|
|
11
11
|
}, {
|
|
12
12
|
after: string;
|
|
13
13
|
before: string;
|
|
14
|
-
outputFormat?: "markdown" | "json" | "both" | undefined;
|
|
14
|
+
outputFormat?: "markdown" | "json" | "both" | "verify-fix-table" | undefined;
|
|
15
15
|
}>;
|
|
16
16
|
export type DiffMemgraphsInput = z.infer<typeof diffMemgraphsSchema>;
|
|
17
17
|
export interface CycleSignature {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "memorydetective",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"mcpName": "io.github.carloshpdoc/memorydetective",
|
|
5
5
|
"description": "MCP server for iOS leak hunting and performance investigation. 34 tools across .memgraph and .trace files, 36-pattern retain-cycle classifier with Swift fixTemplate snippets, abandoned-memory diff for KVO/NotificationCenter/cache shapes that escape leaks(1), per-test CI gate (detectLeaksInXCTest + detectLeaksInXCUITest with self-contained HTML reports), main-thread violation classifier on analyzeHangs, single-call build+boot+launch for the macOS 26.x leaks --outputGraph regression, replayScenario + captureScenarioState verify-fix loop, compareTracesByPattern CI gate on hangs/hitches/launch regressions, SourceKit-LSP source bridging. macOS only (depends on leaks(1) and xctrace).",
|
|
6
6
|
"type": "module",
|