pio_memory_watch
Monitor serial output for heap and stack metrics to detect memory leaks, fragmentation, and stack headroom issues.
Instructions
Watch serial output for heap and stack telemetry and diagnose leaks, fragmentation, and stack headroom. Give session_id of an open monitor session (its buffer plus seconds more) or a port for a one-shot capture. Understands Arduino-ESP32 'Free heap: N min: N largest: N', ESP.getFreeHeap() prints, ESP-IDF heap_caps_print_heap_info blocks, FreeRTOS vTaskList tables, and uxTaskGetStackHighWaterMark lines; pattern (regex with a (?P) group) adds a custom metric. Returns per-metric min/max/trend with a stable/shrinking/growing verdict, a per-task stack table flagged below stack_warn_bytes, and a fragmentation hint. When the firmware prints nothing usable, instrumentation_hint has copy-paste snippets.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| env | No | ||
| baud | No | ||
| port | No | ||
| pattern | No | ||
| seconds | No | ||
| max_lines | No | ||
| session_id | No | ||
| project_dir | No | ||
| stack_warn_bytes | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||