pkarashchenko commented on code in PR #9151:
URL: https://github.com/apache/nuttx/pull/9151#discussion_r1182670122


##########
mm/umm_heap/umm_realloc.c:
##########
@@ -83,7 +77,7 @@ FAR void *realloc(FAR void *oldmem, size_t size)
       mem = mm_realloc(USR_HEAP, oldmem, size);
       if (!mem)
         {
-          brkaddr = sbrk(size);
+          brkaddr = sbrk(size < 1 ? 1 : size);

Review Comment:
   But we do not know the minimum chunk here as `mm_realloc` can be implemented 
as `tlsf_realloc` for example. So what is the other solution then keep trying 
to add 1 more byte. BTW `sbrk` will convert requested size to page size `pgincr 
= MM_NPAGES(incr);`, so it should work correctly with 1 byte increment. The 
other way is to change `sbrk` and handle zero-increment request internally. 
What do you think is better?



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to