1menu "Heap memory debugging"
2
3    choice HEAP_CORRUPTION_DETECTION
4        prompt "Heap corruption detection"
5        default HEAP_POISONING_DISABLED
6        help
7            Enable heap poisoning features to detect heap corruption caused by out-of-bounds access to heap memory.
8
9            See the "Heap Memory Debugging" page of the IDF documentation
10            for a description of each level of heap corruption detection.
11
12        config HEAP_POISONING_DISABLED
13            bool "Basic (no poisoning)"
14        config HEAP_POISONING_LIGHT
15            bool "Light impact"
16        config HEAP_POISONING_COMPREHENSIVE
17            bool "Comprehensive"
18    endchoice
19
20    choice HEAP_TRACING_DEST
21        bool "Heap tracing"
22        default HEAP_TRACING_OFF
23        help
24            Enables the heap tracing API defined in esp_heap_trace.h.
25
26            This function causes a moderate increase in IRAM code side and a minor increase in heap function
27            (malloc/free/realloc) CPU overhead, even when the tracing feature is not used.
28            So it's best to keep it disabled unless tracing is being used.
29
30        config HEAP_TRACING_OFF
31            bool "Disabled"
32        config HEAP_TRACING_STANDALONE
33            bool "Standalone"
34            select HEAP_TRACING
35        config HEAP_TRACING_TOHOST
36            bool "Host-based"
37            select HEAP_TRACING
38    endchoice
39
40    config HEAP_TRACING
41        bool
42        default F
43        help
44            Enables/disables heap tracing API.
45
46    config HEAP_TRACING_STACK_DEPTH
47        int "Heap tracing stack depth"
48        range 0 0 if IDF_TARGET_ARCH_RISCV # Disabled for RISC-V due to `__builtin_return_address` limitation
49        default 0 if IDF_TARGET_ARCH_RISCV
50        range 0 10
51        default 2
52        depends on HEAP_TRACING
53        help
54            Number of stack frames to save when tracing heap operation callers.
55
56            More stack frames uses more memory in the heap trace buffer (and slows down allocation), but
57            can provide useful information.
58
59    config HEAP_TASK_TRACKING
60        bool "Enable heap task tracking"
61        depends on !HEAP_POISONING_DISABLED
62        help
63            Enables tracking the task responsible for each heap allocation.
64
65            This function depends on heap poisoning being enabled and adds four more bytes of overhead for each block
66            allocated.
67
68    config HEAP_ABORT_WHEN_ALLOCATION_FAILS
69        bool "Abort if memory allocation fails"
70        default n
71        help
72            When enabled, if a memory allocation operation fails it will cause a system abort.
73
74endmenu
75