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 2023/01/19 08:41:49 UTC
[nuttx] branch master updated: mm/mm_extend: Increase total heap size accordingly
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
The following commit(s) were added to refs/heads/master by this push:
new 6c2e0b7333 mm/mm_extend: Increase total heap size accordingly
6c2e0b7333 is described below
commit 6c2e0b73334a7405108424a2c4e71d0c07c447b3
Author: Ville Juven <vi...@unikie.com>
AuthorDate: Thu Jan 19 08:32:56 2023 +0200
mm/mm_extend: Increase total heap size accordingly
When adding more heap memory, the total heap size was not updated. This
results in a crash in mm_mallinfo:
DEBUGASSERT((size_t)info->uordblks + info->fordblks == heap->mm_heapsize);
This commit fixes this issue
---
mm/mm_heap/mm_extend.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/mm/mm_heap/mm_extend.c b/mm/mm_heap/mm_extend.c
index 9ffc7e74cb..8ff2ddec0b 100644
--- a/mm/mm_heap/mm_extend.c
+++ b/mm/mm_heap/mm_extend.c
@@ -106,6 +106,10 @@ void mm_extend(FAR struct mm_heap_s *heap, FAR void *mem, size_t size,
newnode->preceding = oldnode->size | MM_ALLOC_BIT;
heap->mm_heapend[region] = newnode;
+
+ /* Finally, increase the total heap size accordingly */
+
+ heap->mm_heapsize += size;
mm_unlock(heap);
/* Finally "free" the new block of memory where the old terminal node was