yamt commented on a change in pull request #2832:
URL: https://github.com/apache/incubator-nuttx/pull/2832#discussion_r583406885



##########
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:
       maybe you can do something like the following instead of kmm_realloc. 
how do you think?
   ```
   new_ptr = kmm_malloc(new_size);
   if (esp32_ptr_extram(new_ptr)) {
       kmm_free(new_ptr);
       return NULL;
   }
   old_size = malloc_usable_size(old_ptr);
   memcpy(new_ptr, old_ptr, min(old_size, new_size));
   kmm_free(old_ptr);
   return new_ptr
   ```




----------------------------------------------------------------
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


Reply via email to