mirror of
https://github.com/apache/nuttx.git
synced 2026-05-29 20:56:47 +08:00
mm: add mm_largest api to get the current largest available memory block
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
This commit is contained in:
@@ -623,6 +623,20 @@ size_t mm_heapfree(struct mm_heap_s *heap)
|
|||||||
{
|
{
|
||||||
return SIZE_MAX;
|
return SIZE_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: mm_heapfree_largest
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Return the largest chunk of contiguous memory in the heap
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
size_t mm_heapfree_largest(FAR struct mm_heap_s *heap)
|
||||||
|
{
|
||||||
|
return SIZE_MAX;
|
||||||
|
}
|
||||||
|
|
||||||
#else /* CONFIG_MM_CUSTOMIZE_MANAGER */
|
#else /* CONFIG_MM_CUSTOMIZE_MANAGER */
|
||||||
|
|
||||||
void up_allocate_heap(void **heap_start, size_t *heap_size)
|
void up_allocate_heap(void **heap_start, size_t *heap_size)
|
||||||
|
|||||||
@@ -390,6 +390,7 @@ struct mallinfo_task mm_mallinfo_task(FAR struct mm_heap_s *heap,
|
|||||||
FAR const struct malltask *task);
|
FAR const struct malltask *task);
|
||||||
|
|
||||||
size_t mm_heapfree(FAR struct mm_heap_s *heap);
|
size_t mm_heapfree(FAR struct mm_heap_s *heap);
|
||||||
|
size_t mm_heapfree_largest(FAR struct mm_heap_s *heap);
|
||||||
|
|
||||||
/* Functions contained in kmm_mallinfo.c ************************************/
|
/* Functions contained in kmm_mallinfo.c ************************************/
|
||||||
|
|
||||||
|
|||||||
@@ -200,3 +200,27 @@ size_t mm_heapfree(FAR struct mm_heap_s *heap)
|
|||||||
{
|
{
|
||||||
return heap->mm_heapsize - heap->mm_curused;
|
return heap->mm_heapsize - heap->mm_curused;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: mm_heapfree_largest
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Return the largest chunk of contiguous memory in the heap
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
size_t mm_heapfree_largest(FAR struct mm_heap_s *heap)
|
||||||
|
{
|
||||||
|
FAR struct mm_freenode_s *node;
|
||||||
|
for (node = heap->mm_nodelist[MM_NNODES - 1].blink; node;
|
||||||
|
node = node->blink)
|
||||||
|
{
|
||||||
|
size_t nodesize = MM_SIZEOF_NODE(node);
|
||||||
|
if (nodesize != 0)
|
||||||
|
{
|
||||||
|
return nodesize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1476,3 +1476,16 @@ size_t mm_heapfree(FAR struct mm_heap_s *heap)
|
|||||||
{
|
{
|
||||||
return heap->mm_heapsize - heap->mm_curused;
|
return heap->mm_heapsize - heap->mm_curused;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: mm_heapfree_largest
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Return the largest chunk of contiguous memory in the heap
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
size_t mm_heapfree_largest(FAR struct mm_heap_s *heap)
|
||||||
|
{
|
||||||
|
return SIZE_MAX;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user