You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2024/10/07 09:35:08 UTC
(nuttx) 03/10: mm: fix memory statistics error
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 8fecd0385bd1ebff69c5273929a55629bbbec141
Author: yinshengkai <yi...@xiaomi.com>
AuthorDate: Tue Nov 14 22:19:52 2023 +0800
mm: fix memory statistics error
Signed-off-by: yinshengkai <yi...@xiaomi.com>
Signed-off-by: Neo Xu <ne...@gmail.com>
---
mm/tlsf/mm_tlsf.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/mm/tlsf/mm_tlsf.c b/mm/tlsf/mm_tlsf.c
index 8296777927..6962eed550 100644
--- a/mm/tlsf/mm_tlsf.c
+++ b/mm/tlsf/mm_tlsf.c
@@ -500,10 +500,6 @@ static void mm_delayfree(FAR struct mm_heap_s *heap, FAR void *mem,
kasan_poison(mem, size);
- /* Update heap statistics */
-
- heap->mm_curused -= size;
-
/* Pass, return to the tlsf pool */
if (delay)
@@ -512,6 +508,9 @@ static void mm_delayfree(FAR struct mm_heap_s *heap, FAR void *mem,
}
else
{
+ /* Update heap statistics */
+
+ heap->mm_curused -= mm_malloc_size(heap, mem);
sched_note_heap(false, heap, mem, size);
tlsf_free(heap->mm_tlsf, mem);
}