mm: fix memory statistics error

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
This commit is contained in:
yinshengkai 2023-11-14 22:19:52 +08:00 committed by Xiang Xiao
parent 2c0e2ac36b
commit cff121bc23

View File

@ -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);
}