kopia lustrzana https://github.com/espressif/esp-idf
heap: remove misleading info about malloc being equivalent to heap_caps_malloc(p, MALLOC_CAP_8BIT)
The actual memory allocated for malloc() depends on a lot of factors, see heap_caps_malloc_default() Closes https://github.com/espressif/esp-idf/issues/7659pull/9730/head
rodzic
836f9875b1
commit
b6248014b9
|
@ -58,8 +58,6 @@ esp_err_t heap_caps_register_failed_alloc_callback(esp_alloc_failed_hook_t callb
|
||||||
*
|
*
|
||||||
* Equivalent semantics to libc malloc(), for capability-aware memory.
|
* Equivalent semantics to libc malloc(), for capability-aware memory.
|
||||||
*
|
*
|
||||||
* In IDF, ``malloc(p)`` is equivalent to ``heap_caps_malloc(p, MALLOC_CAP_8BIT)``.
|
|
||||||
*
|
|
||||||
* @param size Size, in bytes, of the amount of memory to allocate
|
* @param size Size, in bytes, of the amount of memory to allocate
|
||||||
* @param caps Bitwise OR of MALLOC_CAP_* flags indicating the type
|
* @param caps Bitwise OR of MALLOC_CAP_* flags indicating the type
|
||||||
* of memory to be returned
|
* of memory to be returned
|
||||||
|
|
|
@ -30,7 +30,9 @@ For more details on these internal memory types, see :ref:`memory-layout`.
|
||||||
|
|
||||||
It's also possible to connect external SPI RAM to the {IDF_TARGET_NAME} - :doc:`external RAM </api-guides/external-ram>` can be integrated into the {IDF_TARGET_NAME}'s memory map using the flash cache, and accessed similarly to DRAM.
|
It's also possible to connect external SPI RAM to the {IDF_TARGET_NAME} - :doc:`external RAM </api-guides/external-ram>` can be integrated into the {IDF_TARGET_NAME}'s memory map using the flash cache, and accessed similarly to DRAM.
|
||||||
|
|
||||||
DRAM uses capability ``MALLOC_CAP_8BIT`` (accessible in single byte reads and writes). When calling ``malloc()``, the ESP-IDF ``malloc()`` implementation internally calls ``heap_caps_malloc(size, MALLOC_CAP_8BIT)`` in order to allocate DRAM that is byte-addressable. To test the free DRAM heap size at runtime, call cpp:func:`heap_caps_get_free_size(MALLOC_CAP_8BIT)`.
|
DRAM uses capability ``MALLOC_CAP_8BIT`` (accessible in single byte reads and writes). To test the free DRAM heap size at runtime, call cpp:func:`heap_caps_get_free_size(MALLOC_CAP_8BIT)`.
|
||||||
|
|
||||||
|
When calling ``malloc()``, the ESP-IDF ``malloc()`` implementation internally calls cpp:func:`heap_caps_malloc_default(size)`. This will allocate memory with capability ``MALLOC_CAP_DEFAULT``, which is byte-addressable.
|
||||||
|
|
||||||
Because malloc uses the capabilities-based allocation system, memory allocated using :cpp:func:`heap_caps_malloc` can be freed by calling
|
Because malloc uses the capabilities-based allocation system, memory allocated using :cpp:func:`heap_caps_malloc` can be freed by calling
|
||||||
the standard ``free()`` function.
|
the standard ``free()`` function.
|
||||||
|
|
Ładowanie…
Reference in New Issue