in my code, I have registered failed alloc callback:
Code: Select all
esp_err_t error = heap_caps_register_failed_alloc_callback(heap_caps_alloc_failed_hook);
Code: Select all
void heap_caps_alloc_failed_hook(size_t requested_size, uint32_t caps, const char *function_name) {
printf("%s was called but failed to allocate %d bytes with %ld capabilities. \n", function_name, requested_size,caps);
}
Code: Select all
heap_caps_malloc was called but failed to allocate 1696 bytes with 6144 capabilities.
In flash_mock.cpp I have found the following:
Code: Select all
void *heap_caps_malloc( size_t size, uint32_t caps )
{
return NULL;
}
In the heap_caps.c I have also found the real heap_caps_malloc function declaration:
Code: Select all
IRAM_ATTR void *heap_caps_malloc( size_t size, uint32_t caps){
void* ptr = heap_caps_malloc_base(size, caps);
if (!ptr && size > 0){
heap_caps_alloc_failed(size, caps, __func__);
}
return ptr;
}