|
3 | 3 | Heap Tracing |
4 | 4 | ============ |
5 | 5 |
|
6 | | -Heap tracing enables you to monitor memory usage over time by generating and analyzing a `svdat` dump file. The IDF Eclipse Plugin supports generating heap trace files through special breakpoints. For more information on SDK-level configuration and tracing features, refer to the official `ESP-IDF documentation <https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/heap_debug.html>`_. |
| 6 | +:link_to_translation:`zh_CN:[中文]` |
| 7 | + |
| 8 | +Heap tracing allows you to monitor memory usage over time by generating and analyzing a ``svdat`` dump file. The IDF Eclipse Plugin supports generating heap trace files by setting special breakpoints. For more information on SDK-level configuration and tracing features, refer to the official `ESP-IDF documentation <https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/heap_debug.html>`_. |
7 | 9 |
|
8 | 10 | Generating Dump File |
9 | 11 | -------------------- |
10 | | -1. **Open the sysview\_heap\_log.c file** |
| 12 | + |
| 13 | +1. **Open the sysview_heap_log.c File** |
11 | 14 |
|
12 | | - From the Project Explorer, locate and open the `sysview_heap_log.c` file from the **system** templates project. |
| 15 | + From the Project Explorer, locate and open the ``sysview_heap_log.c`` file from the **system** templates project. |
13 | 16 |
|
14 | 17 | .. image:: ../../../media/HeapTracing/sysview_heap_log_file.PNG |
15 | 18 | :alt: sysview_heap_log.c file |
16 | 19 |
|
17 | 20 | 2. **Add a Breakpoint and Configure Properties** |
18 | 21 |
|
19 | | - Add a breakpoint at the desired line, then right-click on the breakpoint icon in the editor and select `Breakpoint Properties…`. |
| 22 | + Add a breakpoint at the desired line, then right-click on the breakpoint icon in the editor and select ``Breakpoint Properties``. |
20 | 23 |
|
21 | 24 | .. image:: ../../../media/HeapTracing/breakpoint_properties_popup.png |
22 | 25 | :alt: Breakpoint Properties |
23 | 26 |
|
24 | 27 | 3. **Define Heap Tracing Action** |
25 | 28 |
|
26 | | - In the Breakpoint Properties window, go to `Actions`, click `New`, and select `Heap Tracing` from the `Action Type` dropdown. |
27 | | - - For the initial breakpoint, set the action to **Start Heap Trace** and specify the save location for the dump file (recommended to store in the project directory). Name the action meaningfully, then click OK. |
| 29 | + In the ``Breakpoint Properties`` window, go to ``Actions``, click ``New``, and select ``Heap Tracing`` from the ``Action Type`` dropdown. |
| 30 | + |
| 31 | + For the initial breakpoint, set the action to ``Start Heap Trace`` and specify the save location for the dump file (it is recommended to store it in the project directory). Name the action meaningfully, then click ``OK``. |
28 | 32 |
|
29 | 33 | .. image:: ../../../media/HeapTracing/heap_tracing_action.png |
30 | 34 | :alt: Heap Tracing Action |
31 | 35 |
|
32 | 36 | 4. **Attach the Action to the Breakpoint** |
33 | 37 |
|
34 | | - After creating the action, click `Attach` to link it to the breakpoint, which will display it under the Actions for this breakpoint section. |
| 38 | + After creating the action, click ``Attach`` to link it to the breakpoint, which will display the action under the ``Actions for this breakpoint`` section. |
35 | 39 |
|
36 | 40 | .. image:: ../../../media/HeapTracing/breakpoint_properties_actions_start_attached.png |
37 | 41 | :alt: Attach Action |
38 | 42 |
|
39 | 43 | 5. **Apply and Create Additional Breakpoint** |
40 | 44 |
|
41 | | - Now you have a breakpoint that will start tracing and generate a dump file. To stop the tracing, create another breakpoint (e.g., at line 102), set its properties, and choose the **Stop Heap Trace** option in the action settings. Attach this action to the breakpoint as shown below. |
| 45 | + Now you have a breakpoint that will start tracing and generate a dump file. To stop the tracing, create another breakpoint (e.g., at line 102), set its properties, and choose the ``Stop Heap Trace`` option in the action settings. Attach this action to the breakpoint as shown below. |
42 | 46 |
|
43 | 47 | .. image:: ../../../media/HeapTracing/breakpoint_properties_actions_stop_attached.png |
44 | 48 | :alt: Stop Heap Trace Action |
45 | 49 |
|
46 | 50 | 6. **Launch Debug Configuration** |
47 | 51 |
|
48 | | - Launch the debug configuration for your ESP32 board. When the program hits the breakpoints, the IDE will prompt you to switch to the debugger perspective. Continue execution for each breakpoint to start and stop tracing. Refresh the project in the Project Explorer to view the dump file in the specified location. |
| 52 | + Launch the debug configuration for your ESP32 board. When the program hits the breakpoints, the IDE will prompt you to switch to the debugger perspective. Continue execution at each breakpoint to start or stop tracing, then refresh the project in the Project Explorer to view the dump file at the specified location. |
49 | 53 |
|
50 | 54 | Analyzing the Dump File |
51 | 55 | ----------------------- |
52 | 56 |
|
53 | | -The IDF Eclipse Plugin allows you to analyze generated `svdat` dump files. Right-click on the dump file and select `Heap Dump Analysis` from the context menu. |
| 57 | +The IDF Eclipse Plugin allows you to analyze generated ``svdat`` dump files. Right-click on the dump file and select ``ESP-IDF: Heap Dump Analysis`` from the context menu. |
54 | 58 |
|
55 | | -**Note:** Ensure the project is built with the appropriate symbols file to enable analysis. |
| 59 | +.. note:: |
| 60 | + |
| 61 | + Ensure the project is built with the appropriate symbols file to enable analysis. |
56 | 62 |
|
57 | 63 | .. image:: ../../../media/HeapTracing/analysis_context_menu.png |
58 | 64 | :alt: Heap Dump Analysis Context Menu |
59 | 65 |
|
60 | | -Overview Tab |
61 | | -------------- |
62 | | -The Overview Tab displays memory consumption over time in a graph format. By default, all contexts are shown; you can select specific contexts corresponding to heap events. |
| 66 | +``Overview`` Tab |
| 67 | +---------------- |
| 68 | + |
| 69 | +The ``Overview`` Tab displays memory consumption over time in a graph format. By default, all contexts are shown, but you can select specific contexts corresponding to heap events. |
63 | 70 |
|
64 | 71 | .. image:: ../../../media/HeapTracing/overview_tab_tracing.png |
65 | 72 | :alt: Memory Consumption Graph |
66 | 73 |
|
67 | | -For example, selecting multiple contexts displays them separately on the graph. |
| 74 | +For example, selecting multiple contexts displays each of them separately on the graph. |
68 | 75 |
|
69 | 76 | .. image:: ../../../media/HeapTracing/overview_tab_tracing_contexts.png |
70 | 77 | :alt: Selected Contexts in Graph |
71 | 78 |
|
72 | | -Details Tab |
73 | | -------------- |
74 | | -The Details Tab provides further insights, showing each event in the heap trace. Rows highlighted in light orange indicate potential memory leaks (since the trace may have ended before a free event was detected). Green rows show free heap events. |
| 79 | +``Details`` Tab |
| 80 | +--------------- |
| 81 | + |
| 82 | +The ``Details`` Tab provides further insights by showing each event in the heap trace. Rows highlighted in light orange indicate potential memory leaks, as the trace may have ended before a corresponding free event was detected. Rows highlighted in green indicate free heap events. |
75 | 83 |
|
76 | 84 | .. image:: ../../../media/HeapTracing/details_tab_tracing.png |
77 | 85 | :alt: Details Tab |
78 | 86 |
|
79 | | -To filter entries for possible memory leaks, check the `View Possible Memory Leaks` box. Right-clicking on any entry allows you to view callers, opening the `Callers View` to display the call stack for the heap event. |
| 87 | +To filter entries for possible memory leaks, check the ``View Possible Memory Leaks`` box. Right-clicking on any entry allows you to view its callers by opening the ``Callers View``, which displays the call stack for the heap event. |
80 | 88 |
|
81 | 89 | .. image:: ../../../media/HeapTracing/show_callers_context_menu.png |
82 | 90 | :alt: Show Callers |
83 | 91 |
|
84 | | -Clicking on an entry in the `Callers View` will navigate to the corresponding line in the source file. |
| 92 | +Clicking on an entry in the ``Callers View`` will navigate to the corresponding line in the source file. |
85 | 93 |
|
86 | 94 | .. image:: ../../../media/HeapTracing/callers_view.png |
87 | | - :alt: Callers View |
| 95 | + :alt: Callers View |
0 commit comments