MultiNet7 heap use keeps falling on ESP32-P4 despite repeated clean() calls
A Juejin article analyzes ESP-SR issue #225, in which a user running MultiNet7 on an ESP32-P4 (ESP-IDF 5.5.4, ESP-SR 1.9.5, mn7_en_quantized) saw internal free memory decline about 5.5 B/s even though clean() was called after every ESP_MN_STATE_TIMEOUT. Across six heap-trace snapshots taken roughly every four minutes, live blocks at the ctc_path_alloc site rose from 18 to 178 over about 26 minutes while total free briefly recovered, and quiet input versus background music produced similar growth. The reporter's binary analysis of prebuilt libmultinet.a suggests model_reset() and model_destroy() free RNNT beams but lack a matching ctc_beams_free(), though this has not been independently verified or reproduced on board.
The case offers a concrete heap-tracing and attribution methodology for embedded speech-recognition memory growth, but the suspected missing cleanup path remains an unreproduced hypothesis rather than a confirmed root cause or a maintainer-acknowledged fix.
MultiNet7 每轮都 clean,ESP32-P4 内存为什么还在掉?
clean() 已经按超时调用,内部堆却持续变小。此时再多调用一次清理函数,未必能回答问题:究竟是应用忘了清理、堆碎片化,还是库内部的某类对象仍存活?ESP-SR issue #225 给了一个值得拆开的用户案例。
报告者的板上运行环境是 ESP32-P4、ESP-IDF 5.5.4、ESP-SR 1.9.5、mn7_en_quantized。他另称在 ESP-SR 2.4.7 的预编译 libmultinet.a 中看到同类调用目标缺口;这里的 2.4.7 证据是报告者的二进制分析,不是 2.4.7 的板上回归结果。报告者把 MultiNet 当常开检测器,持续输入 16 kHz 音频,每次 512 个采样点;每次 ESP_MN_STATE_TIMEOUT 后调用 clean()。本文没有对这两版做板卡复现或独立反汇编。下面的数据均是报告者观察,不能外推成所有 MultiNet7 版本和调用模式的通病。