yamt commented on a change in pull request #2832: URL: https://github.com/apache/incubator-nuttx/pull/2832#discussion_r579907607
########## File path: arch/xtensa/src/esp32/esp32_allocateheap.c ########## @@ -130,6 +143,10 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size) { board_autoled_on(LED_HEAPALLOCATE); +#ifdef CONFIG_XTENSA_IMEM_MAXIMIZE_HEAP_REGION + *heap_size = HEAP_REGION_OFFSET; + *heap_start = (size_t)(HEAP_REGION1_END - *heap_size); Review comment: what's this size_t cast for? ########## File path: arch/xtensa/src/esp32/esp32_wifi_adapter.c ########## @@ -3447,7 +3469,17 @@ static void *esp_malloc_internal(size_t size) static void *esp_realloc_internal(void *ptr, size_t size) { +#ifdef CONFIG_XTENSA_IMEM_USE_SEPARATE_HEAP + return xtensa_imm_realloc(ptr, size); +#else + if (size == 0 || esp32_ptr_extram(ptr)) + { + esp_free(ptr); + return NULL; + } + return kmm_realloc(ptr, size); Review comment: i guess you want to check esp32_ptr_extram on the result of kmm_realloc. ########## File path: arch/xtensa/src/esp32/esp32_wifi_adapter.c ########## @@ -3447,7 +3469,17 @@ static void *esp_malloc_internal(size_t size) static void *esp_realloc_internal(void *ptr, size_t size) { +#ifdef CONFIG_XTENSA_IMEM_USE_SEPARATE_HEAP + return xtensa_imm_realloc(ptr, size); +#else + if (size == 0 || esp32_ptr_extram(ptr)) + { + esp_free(ptr); + return NULL; Review comment: * size == 0 case is better to be left to kmm_realloc * standard realloc is supposed to preserve the old memory in case of a failure. does this wifi_osi_funcs_t variant have a different semantics? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org