tv_heap
Take a device heap snapshot and compare two snapshots to detect leaks: see total nodes, shallow size, detached DOM nodes, and top constructors' growth/shrink.
Instructions
Take a heap snapshot on the device and/or compare two of them — the tool for "the heap grew and never came back". Leak hunt: tv_heap action:"snapshot" (before) -> do the scenario (tv_press / tv_menu / tv_sequence) -> tv_heap action:"snapshot" (after) -> tv_heap action:"diff" with the two paths. A snapshot writes a .heapsnapshot file (open it in Chrome DevTools -> Memory -> Load) and returns the Summary view in numbers: total nodes and shallow size, how many DETACHED DOM nodes are still retained, and the top-N constructors by shallow size. diff returns the deltas — which constructors gained objects and bytes (topGrowth) and which lost them (topShrink), like the DevTools Comparison view. Retainer paths ("who holds this") and retained/dominator sizes are deliberately NOT computed: load the saved files in DevTools for those. A snapshot forces a full GC and pauses V8 for a long time (it can take a minute on a TV), so it is refused while a tv_profile recording is running. Needs the HeapProfiler domain — fine on tizen55/webos7/pc, best-effort on webOS 3. diff is a pure file operation: no device needed.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | snapshot: where to write the .heapsnapshot. Defaults to a scratch path. | |
| topN | No | How many constructors to report (default 20). | |
| after | No | diff: path to the later .heapsnapshot. | |
| action | Yes | snapshot: take one on the device. diff: compare two files already on disk. | |
| before | No | diff: path to the earlier .heapsnapshot. | |
| device | No | Device id from devices.json. Omit to use the default device. | |
| timeoutMs | No | snapshot: give up after this long (default 120000 — a full heap off a slow TV legitimately takes tens of seconds). |