espressif / esp-dl

Espressif deep-learning library for AIoT applications
MIT License
516 stars 115 forks source link

如何分析内存占用 (AIV-469) #79

Closed notplus closed 2 years ago

notplus commented 2 years ago

Hi,请问是否提供内存占用分析工具?比如查看运行时峰值内存占用,另外能否判断模型推理时有无使用PSRAM?非常感谢

TiramisuJ commented 2 years ago

Hi

  1. 你可以通过在调用 printf("%s: free RAM size: %d, INTERNAL: %d, PSRAM: %d\n", tag, heap_caps_get_free_size(MALLOC_CAP_8BIT), heap_caps_get_free_size(MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL), heap_caps_get_free_size(MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM)); 来打印目前剩余的内存信息。
  2. 你也可以通过打印内存的起始地址,来判断这段内存是被申请在PSRAM中还是在internal RAM中。
notplus commented 2 years ago

好的,多谢。