CV-Bowen opened a new pull request #1112:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1112


   ## Summary
   Add the memory boundary realloc test.
   
   When CONFIG_MM_SMALL enable and CONFIG_DEBUG_MM disable, 
**SIZEOF_MM_ALLOCNODE = 4, MM_MIN_CHUNK = 16, SIZEOF_MM_FRENODE = 12**.
   
   
![image](https://user-images.githubusercontent.com/39286361/160780737-4534ce80-c0b6-42d5-b33d-8b886eb8012a.png)
   In above figure, **HEAP_SIZE** is not aligned with **MM_MIN_CHUNK** (because 
**(2 * SIZEOF_MM_ALLOCNODE) != MM_MIN_CHUNK)**), nodeA is a malloced memory 
node, nodeB is a free memory node and adjacent to heap end node. In this 
situation, realloc the nodeA may lead the remain size be **(MM_MIN_CHUNK - 2 * 
SIZEOF_MM_ALLOCNODE) = 8**, which is not large enough to hold a free node, so 
software will assert fail at mm_heap/mm_realloc.c line: 319.
   
   Related PR: https://github.com/apache/incubator-nuttx/pull/5906
   
   @masayuki2009
   
   ## Testing
   Test with nucleo-144 stm32f746zg
   


-- 
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: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to