EasyManuals Logo

Espressif ESP32-S2 User Manual

Espressif ESP32-S2
1695 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #985 background imageLoading...
Page #985 background image
Chapter 2. API Reference
Functions
esp_err_t heap_caps_register_failed_alloc_callback(esp_alloc_failed_hook_t callback)
registers a callback function to be invoked if a memory allocation operation fails
Return ESP_OK if callback was registered.
Parameters
callback: caller defined callback to be invoked
void *heap_caps_malloc(size_t size, uint32_t caps)
Allocate a chunk of memory which has the given capabilities.
Equivalent semantics to libc malloc(), for capability-aware memory.
In IDF, malloc(p) is equivalent to heap_caps_malloc(p, MALLOC_CAP_8BIT).
Return A pointer to the memory allocated on success, NULL on failure
Parameters
size: Size, in bytes, of the amount of memory to allocate
caps: Bitwise OR of MALLOC_CAP_* flags indicating the type of memory to be returned
void heap_caps_free(void *ptr)
Free memory previously allocated via heap_caps_malloc() or heap_caps_realloc().
Equivalent semantics to libc free(), for capability-aware memory.
In IDF, free(p) is equivalent to heap_caps_free(p).
Parameters
ptr: Pointer to memory previously returned from heap_caps_malloc() or heap_caps_realloc(). Can
be NULL.
void *heap_caps_realloc(void *ptr, size_t size, uint32_t caps)
Reallocate memory previously allocated via heap_caps_malloc() or heap_caps_realloc().
Equivalent semantics to libc realloc(), for capability-aware memory.
In IDF, realloc(p, s) is equivalent to heap_caps_realloc(p, s, MALLOC_CAP_8BIT).
capsparameter can be different to the capabilities that any original ptrwas allocated with. In this way,
realloc can be used to movea buffer if necessary to ensure it meets a new set of capabilities.
Return Pointer to a new buffer of size sizewith capabilities caps, or NULL if allocation failed.
Parameters
ptr: Pointer to previously allocated memory, or NULL for a new allocation.
size: Size of the new buffer requested, or 0 to free the buffer.
caps: Bitwise OR of MALLOC_CAP_* flags indicating the type of memory desired for the new
allocation.
void *heap_caps_aligned_alloc(size_t alignment, size_t size, uint32_t caps)
Allocate a aligned chunk of memory which has the given capabilities.
Equivalent semantics to libc aligned_alloc(), for capability-aware memory.
Return A pointer to the memory allocated on success, NULL on failure
Parameters
alignment: How the pointer received needs to be aligned must be a power of two
size: Size, in bytes, of the amount of memory to allocate
caps: Bitwise OR of MALLOC_CAP_* flags indicating the type of memory to be returned
void heap_caps_aligned_free(void *ptr)
Used to deallocate memory previously allocated with heap_caps_aligned_alloc.
Note This function is deprecated, plase consider using heap_caps_free() instead
Parameters
ptr: Pointer to the memory allocated
void *heap_caps_aligned_calloc(size_t alignment, size_t n, size_t size, uint32_t caps)
Allocate a aligned chunk of memory which has the given capabilities. The initialized value in the memory is
set to zero.
Espressif Systems 974
Submit Document Feedback
Release v4.4

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Espressif ESP32-S2 and is the answer not in the manual?

Espressif ESP32-S2 Specifications

General IconGeneral
BrandEspressif
ModelESP32-S2
CategorySingle board computers
LanguageEnglish