diff options
Diffstat (limited to 'docs/library/esp32.rst')
-rw-r--r-- | docs/library/esp32.rst | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/docs/library/esp32.rst b/docs/library/esp32.rst index 5df1f3c93..bfef5a32d 100644 --- a/docs/library/esp32.rst +++ b/docs/library/esp32.rst @@ -38,6 +38,30 @@ Functions Read the raw value of the internal Hall sensor, returning an integer. +.. function:: idf_heap_info(capabilities) + + Returns information about the ESP-IDF heap memory regions. One of them contains + the MicroPython heap and the others are used by ESP-IDF, e.g., for network + buffers and other data. This data is useful to get a sense of how much memory + is available to ESP-IDF and the networking stack in particular. It may shed + some light on situations where ESP-IDF operations fail due to allocation failures. + The information returned is *not* useful to troubleshoot Python allocation failures, + use `micropython.mem_info()` instead. + + The capabilities parameter corresponds to ESP-IDF's ``MALLOC_CAP_XXX`` values but the + two most useful ones are predefined as `esp32.HEAP_DATA` for data heap regions and + `esp32.HEAP_EXEC` for executable regions as used by the native code emitter. + + The return value is a list of 4-tuples, where each 4-tuple corresponds to one heap + and contains: the total bytes, the free bytes, the largest free block, and + the minimum free seen over time. + + Example after booting:: + + >>> import esp32; esp32.idf_heap_info(esp32.HEAP_DATA) + [(240, 0, 0, 0), (7288, 0, 0, 0), (16648, 4, 4, 4), (79912, 35712, 35512, 35108), + (15072, 15036, 15036, 15036), (113840, 0, 0, 0)] + Flash partitions ---------------- @@ -88,6 +112,10 @@ Constants Used in `Partition.find` to specify the partition type. +.. data:: HEAP_DATA + HEAP_EXEC + + Used in `idf_heap_info`. .. _esp32.RMT: |