Skip to content

Commit d308198

Browse files
committed
Merge branch 'docs/update_cn_translation_for_heap_debug' into 'master'
docs: Update CN translation for heap debug Closes DOC-9613 See merge request espressif/esp-idf!35293
2 parents cd225d0 + f6dde85 commit d308198

File tree

2 files changed

+176
-61
lines changed

2 files changed

+176
-61
lines changed

docs/en/api-reference/system/heap_debug.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ Temporarily increasing the heap corruption detection level can give more detaile
137137

138138
In the project configuration menu, under ``Component config``, there is a menu ``Heap memory debugging``. The option :ref:`CONFIG_HEAP_CORRUPTION_DETECTION` can be set to one of the following three levels:
139139

140+
140141
Basic (No Poisoning)
141142
++++++++++++++++++++
142143

@@ -146,6 +147,7 @@ If assertions are enabled, an assertion will also trigger if a double-free occur
146147

147148
Calling :cpp:func:`heap_caps_check_integrity` in Basic mode checks the integrity of all heap structures, and print errors if any appear to be corrupted.
148149

150+
149151
Light Impact
150152
++++++++++++
151153

@@ -165,14 +167,15 @@ In both cases, the functions involve checking that the first 4 bytes of an alloc
165167

166168
Different values usually indicate buffer underrun or overrun. Overrun indicates that when writing to memory, the data written exceeds the size of the allocated memory, resulting in writing to an unallocated memory area; underrun indicates that when reading memory, the data read exceeds the allocated memory and reads data from an unallocated memory area.
167169

170+
168171
Comprehensive
169172
+++++++++++++
170173

171174
This level incorporates the "Light Impact" detection features. Additionally, it checks for uninitialized-access and use-after-free bugs. In this mode, all freshly allocated memory is filled with the pattern ``0xCE``, and all freed memory is filled with the pattern ``0xFE``.
172175

173176
Enabling Comprehensive mode has a substantial impact on runtime performance, as all memory needs to be set to the allocation patterns each time a :cpp:func:`heap_caps_malloc` or :cpp:func:`heap_caps_free` completes, and the memory also needs to be checked each time. However, this mode allows easier detection of memory corruptions which are much more subtle to find otherwise. It is recommended to only enable this mode when debugging, not in production.
174177

175-
The checks for allocated and free patterns (``0xCE`` and respectively ``0xFE``) are also done when calling :cpp:func:`heap_caps_check_integrity` or :cpp:func:`heap_caps_check_integrity_all`.
178+
The checks for allocated and free patterns (``0xCE`` and ``0xFE``, respectively) are also done when calling :cpp:func:`heap_caps_check_integrity` or :cpp:func:`heap_caps_check_integrity_all`.
176179

177180
Crashes in Comprehensive Mode
178181
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -404,7 +407,7 @@ For this reason, the option to use a hashmap mechanism to store records is avail
404407

405408
Each hashmap entry is a singly linked list of records sharing the same hash ID.
406409

407-
Each record hash ID is calculated based on the pointer to the memory they track. The hash function used is based on the Fowler-Noll-Vo hash function modified to ensure an even spread of all records in the range [0 ; hashmap size[ where hashmap size can be defined by setting ``Component config`` > ``Heap Memory Debugging`` > :ref:`CONFIG_HEAP_TRACE_HASH_MAP_SIZE` in the project configuration menu.
410+
Each record hash ID is calculated based on the pointer to the memory they track. The hash function used is based on the Fowler-Noll-Vo hash function modified to ensure an even spread of all records in the range [0, hashmap size[ where hashmap size can be defined by setting ``Component config`` > ``Heap Memory Debugging`` > :ref:`CONFIG_HEAP_TRACE_HASH_MAP_SIZE` in the project configuration menu.
408411

409412
.. note::
410413

0 commit comments

Comments
 (0)