MCP cdp_heap_sampling_start

Description

Start a lightweight heap allocation sampling capture on the debugged Roku app via CDP HeapProfiler.startSampling.

Requires rk server mode: this tool talks to the server's owned CDP connection, not a private socket. Unlike cdp_heap_snapshot, this does not capture full retained heap content -- it samples allocation call sites over time, which is far cheaper to run continuously. The response is a handle only; call cdp_heap_sampling_stop to end the capture and write the .heapprofile to disk.

Confirmed on-device: this only shows allocations still live when you call cdp_heap_sampling_stop. An allocation site whose objects were all garbage-collected before stop shows zero samples, as if it never allocated -- this is a retained-memory-by-call-site view, not an allocation-churn view. A small or empty profile after real allocation activity means the GC ran, not that capture failed.

Optional parameters:

  • sessionId (string): Session id returned by cdp_session_create. Uses the active session when omitted.
  • samplingIntervalBytes (number): Average number of bytes allocated between samples. Defaults to
    32768 (32KB) -- Chrome DevTools Protocol's own default. A smaller interval samples more often
    (finer detail, more overhead); a larger interval samples less often.
  • output (string): Output .heapprofile file path (must stay within project root). Auto-generated
    under the project root when omitted.

Response:

  • captureId (string): Handle used by cdp_heap_sampling_stop.
  • samplingIntervalBytes (number): The interval actually requested.

Notes:

  • Only one active heap sampling capture per session is allowed. Duplicate start returns
    409 SAMPLING_ALREADY_ACTIVE.

See also

Parameters

additionalProperties: false

NameTypeRequiredValues
sessionIdstringNo
samplingIntervalBytesintegerNo
outputstringNo

sessionId

Session id returned by cdp_session_create. Uses the active session when omitted.

samplingIntervalBytes

Average bytes allocated between samples (default 32768)

output

Output .heapprofile file path (must stay within project root when provided)


Did this page help you?