esp_cache_aligned_malloc_prefer() function
Helper function for malloc a cache aligned data memory buffer as preference in decreasing order. @deprecated This function is deprecated and will be removed in the future. Use 'heap_caps_malloc_prefer' with MALLOC_CAP_CACHE_ALIGNED caps instead
Syntax
__attribute__((deprecated("Use 'heap_caps_malloc_prefer' with MALLOC_CAP_CACHE_ALIGNED caps instead")))
esp_err_t esp_cache_aligned_malloc_prefer(size_t size,
void **out_ptr,
size_t *actual_size,
size_t flag_nums, ...);
Arguments
size
Size in bytes, the amount of memory to allocate
out_ptr
A pointer to the memory allocated successfully
actual_size
Actual size for allocation in bytes, when the size you specified doesn't meet the cache alignment requirements, this value might be bigger than the size you specified. Set null if you don't care this value.
flag_nums
Number of variable parameters
Return value
- ESP_OK: - ESP_ERR_INVALID_ARG: Invalid argument - ESP_ERR_NO_MEM: No enough memory for allocation
Notes
Now only support 'MALLOC_CAP_INTERNAL', 'MALLOC_CAP_DMA' and 'MALLOC_CAP_SPIRAM'
esp_cache_aligned_malloc_prefer() calls 4 functions:
![]()
esp_cache_aligned_malloc_prefer()
esp_cache_aligned_malloc_prefer() reads 2 variables:
![]()
esp_cache_aligned_malloc_prefer()