Mac: profiler-load load_native reports 'Memory leaks: 0' for a Time Profiler recording that never checked leaks

Open
#1,925 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
Half a day
Newbie friendliness
42/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
macos, typescript, xml
Domain
tooling

Research direction

Start with the leak-detection path in native-profiler/platforms/ios.ts (leaksDetailExported around lines 971-976, and the note near line 832) and the loadNativeSession Mac handling in query/profiler-load.ts around lines 413-438. The reproduction uses the LEAKS_NOT_CHECKED fixture in test/ios-instruments/macos-analyze-report.test.ts. Done means load_native reports leaks as not recorded for an empty Time Profiler export, matching what native-profiler-analyze says. Note the work touches code from an unmerged branch, so confirm the base before editing.

Written by the indexing model from the issue text.

Description

[Diplomat, Opus 5.5]: Found while reviewing #1883. The code comes from #1875 (feat/macos-profiling, 73ea75e3d) and is not on main.

Problem

On a Mac app, native-profiler-analyze counts a leaks export as leak data only when it holds the Leaks detail (native-profiler/platforms/ios.ts:971-976, leaksDetailExported). With template_path: "Time Profiler", Xcode 26.6's xctrace exports an empty <trace-query-result> and exits 0. That is the template the Mac leak-check note (ios.ts:832) tells the agent to re-record with.

Its twin loadNativeSession has no Mac branch. It sets leaksRecorded: files.leaks != null (query/profiler-load.ts:414) and prints Memory leaks: ${files.leaks ? memoryLeaks.length : "not recorded"} (:438). The comment at :413 ("Stop writes no raw_leaks.xml when the trace had no Leaks table") does not hold for this case.

Repro

Through the real tool-server, on a Mac app session whose raw_leaks.xml is the empty export (the LEAKS_NOT_CHECKED fixture from test/ios-instruments/macos-analyze-report.test.ts):

  1. profiler-load {mode: "load_native", ...} -> - Memory leaks: 0
  2. profiler-stack-query {mode: "leak_stacks"} -> _No memory leaks detected._
  3. native-profiler-analyze on the same files -> No leak data was recorded, so memory leaks were not checked. Do not report the app as leak-free.

Impact

After a reload (a before/after comparison, or a tool-server restart), the agent is told that a Time Profiler recording found no leaks, when leaks were never checked.

Dominant language
TypeScript
Stars
3.2k
Forks
154
Avg merge
2d 2h
Merged PRs (30d)
88

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from software-mansion/argent

All issues in software-mansion/argent

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.