pkarashchenko commented on code in PR #13898:
URL: https://github.com/apache/nuttx/pull/13898#discussion_r1798616065
##########
mm/tlsf/mm_tlsf.c:
##########
@@ -595,7 +595,18 @@ static void mm_delayfree(FAR struct mm_heap_s *heap, FAR
void *mem,
size_t size = mm_malloc_size(heap, mem);
UNUSED(size);
#ifdef CONFIG_MM_FILL_ALLOCATIONS
- memset(mem, MM_FREE_MAGIC, size);
+#if CONFIG_MM_FREE_DELAYCOUNT_MAX > 0
+ /* If delay free is enabled, a memory node will be freed twice.
+ * The first time is to add the node to the delay list, and the second
+ * time is to actually free the node. Therefore, we only colorize the
+ * memory node the first time, when `delay` is set to true.
+ */
+
+ if (delay)
+#endif
Review Comment:
```suggestion
# endif
```
##########
mm/tlsf/mm_tlsf.c:
##########
@@ -595,7 +595,18 @@ static void mm_delayfree(FAR struct mm_heap_s *heap, FAR
void *mem,
size_t size = mm_malloc_size(heap, mem);
UNUSED(size);
#ifdef CONFIG_MM_FILL_ALLOCATIONS
- memset(mem, MM_FREE_MAGIC, size);
+#if CONFIG_MM_FREE_DELAYCOUNT_MAX > 0
Review Comment:
```suggestion
# if CONFIG_MM_FREE_DELAYCOUNT_MAX > 0
```
##########
mm/mm_heap/mm_free.c:
##########
@@ -102,7 +102,18 @@ void mm_delayfree(FAR struct mm_heap_s *heap, FAR void
*mem, bool delay)
nodesize = mm_malloc_size(heap, mem);
#ifdef CONFIG_MM_FILL_ALLOCATIONS
- memset(mem, MM_FREE_MAGIC, nodesize);
+#if CONFIG_MM_FREE_DELAYCOUNT_MAX > 0
Review Comment:
```suggestion
# if CONFIG_MM_FREE_DELAYCOUNT_MAX > 0
```
##########
mm/mm_heap/mm_free.c:
##########
@@ -102,7 +102,18 @@ void mm_delayfree(FAR struct mm_heap_s *heap, FAR void
*mem, bool delay)
nodesize = mm_malloc_size(heap, mem);
#ifdef CONFIG_MM_FILL_ALLOCATIONS
- memset(mem, MM_FREE_MAGIC, nodesize);
+#if CONFIG_MM_FREE_DELAYCOUNT_MAX > 0
+ /* If delay free is enabled, a memory node will be freed twice.
+ * The first time is to add the node to the delay list, and the second
+ * time is to actually free the node. Therefore, we only colorize the
+ * memory node the first time, when `delay` is set to true.
+ */
+
+ if (delay)
+#endif
Review Comment:
```suggestion
# endif
```
--
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]