Skip to content

Add memory diagnostics artifacts under perf memory #698

@thymikee

Description

@thymikee

Parent

#694

What to build

Add memory diagnostics under perf memory so agents have one symptom-oriented place for memory growth and leak evidence. This issue groups memory work because Android heap dumps, iOS memgraph/leaks, and native allocation traces are all escalations from the same agent question: what is growing or retained?

Prototype CLI shape:

agent-device perf memory sample --json
agent-device perf memory snapshot --out heap.artifact
agent-device perf memory snapshot --kind android-hprof --out app.hprof
agent-device perf memory snapshot --kind memgraph --out app.memgraph
agent-device perf memory trace start --kind heapprofd --out allocations.perfetto-trace
agent-device perf memory trace stop --kind heapprofd --out allocations.perfetto-trace

Expected agent experience:

  • Agents first use perf memory sample --json for a lightweight memory snapshot.
  • Agents escalate to perf memory snapshot only when there is a focused repro or memory-growth symptom.
  • Heap/memgraph artifacts are returned as paths with compact summaries and clear next-step hints.
  • Heavy analyzers such as Shark or heapprofd reports are optional follow-ups, not required for the first artifact-capture path.

Acceptance criteria

  • perf memory sample --json preserves or refines the existing memory metric behavior from perf metrics.
  • Android app sessions can capture a Java heap dump artifact and return the artifact path plus compact metadata.
  • iOS memgraph/leaks support is investigated and the support matrix clearly states simulator/device/macOS availability before implementation is claimed.
  • heapprofd/native allocation tracing is integrated only after Perfetto plumbing is available, or explicitly deferred with documented rationale.
  • Commands fail with actionable hints when app process identity, permissions, profileability, or host tooling is unavailable.
  • Large memory artifacts are never dumped into agent context.
  • Agent-facing help distinguishes lightweight memory sampling from heavy heap/memgraph capture.

Validation

  • Android platform unit tests for heap dump command construction and artifact pulling.
  • Apple platform unit tests for supported memgraph/leaks command construction or explicit unsupported responses.
  • Provider-backed scenario for memory artifact lifecycle where practical.
  • pnpm check:unit
  • pnpm format

Blocked by

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions