1# Heap Task Tracking Example 2 3## Overview 4 5The example creates a task which allocates random amount of memory in each iteration and demonstrates use of internal API to get heap info on per task basis running in a system. 6 7Heap task tracking feature has dependency on some of the internal heap debugging features (e.g. heap poisoning) which allows to store task control block in metadata of each heap block. 8 9This adds small memory overhead on per heap block and hence this feature should be used for debugging purpose only. 10 11### Configure the project 12 13To change the `Heap Corruption Detection level`, open the project configuration menu (`idf.py menuconfig`). 14 15Navigate to `Component config -> Heap memory debugging` menu. In `Heap corruption detection` menu select either "Light Impact" or "Comprehensive". 16 17**Note:** Enabling “Comprehensive” detection has a substantial runtime performance impact. 18 19### Build and Flash 20 21Run `idf.py -p PORT flash monitor` to build and flash the project.. 22 23(To exit the serial monitor, type ``Ctrl-]``.) 24 25See the [Getting Started Guide](https://docs.espressif.com/projects/esp-idf/en/latest/get-started/index.html) for full steps to configure and use ESP-IDF to build projects. 26 27## Example Output 28 29``` 30Task: Pre-Scheduler allocs -> CAP_8BIT: 5360 CAP_32BIT: 0 31Task: esp_timer -> CAP_8BIT: 1724 CAP_32BIT: 0 32Task: ipc0 -> CAP_8BIT: 8316 CAP_32BIT: 0 33Task: main -> CAP_8BIT: 3480 CAP_32BIT: 0 34Task: ipc1 -> CAP_8BIT: 12 CAP_32BIT: 0 35Task: example_task -> CAP_8BIT: 696 CAP_32BIT: 0 36``` 37