简体   繁体   English

如何在 ESP32 中跟踪堆内存泄漏问题?

[英]How to tracing heap memory leak problem in ESP32?

Sorry for the newbie question and I am new to the embedded system development.对不起,新手问题,我是嵌入式系统开发的新手。

I am using ESP32 chip to develop a project, but found that the heap size seem steadily decrease.我正在使用 ESP32 芯片开发一个项目,但发现堆大小似乎在稳步下降。 I have use the我已经使用了

MDF_LOGD("the free heap size is %d --root_write_task(start)", esp_get_minimum_free_heap_size());

to check every function in the main program but still cannot find any leakage point and the IDF APP Tracer seem not working at all.检查主程序中的每个功能,但仍然找不到任何泄漏点,IDF APP Tracer 似乎根本不起作用。 Basically no output at all.基本没有输出。

I am quite worry that I have clone some driver to my program and cause this issue.我很担心我已经将一些驱动程序克隆到我的程序并导致这个问题。 Any other way to check such issue?还有其他方法可以检查此类问题吗? I am using vscode with esp-idf extension.我正在使用带有 esp-idf 扩展名的 vscode。

Here are some great resources which could help you on this.这里有一些很好的资源,可以帮助你解决这个问题。

Memory Management - FreeRTOS内存管理 - FreeRTOS

Mastering the FreeRTOS Real Time Kernel 掌握 FreeRTOS 实时内核

Heap Memory Debugging - Espressif 堆内存调试 - 乐鑫

The correct function to call to get the heap size is esp_get_free_heap_size() .调用以获取堆大小的正确函数是esp_get_free_heap_size() The best way to check for memory leaks is to connect your device with JTAG and debug it in that way.检查内存泄漏的最佳方法是将您的设备与 JTAG 连接并以这种方式调试它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM