Skip to content

Commit 4c399f8

Browse files
authored
Merge pull request #4192 from Jedcheen/master
add rt_memory_info() for memheap.c
2 parents 4529e9a + b71a0eb commit 4c399f8

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/memheap.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -712,6 +712,20 @@ void *rt_calloc(rt_size_t count, rt_size_t size)
712712
}
713713
RTM_EXPORT(rt_calloc);
714714

715+
void rt_memory_info(rt_uint32_t *total,
716+
rt_uint32_t *used,
717+
rt_uint32_t *max_used)
718+
{
719+
if (total != RT_NULL)
720+
*total = _heap.pool_size;
721+
722+
if (used != RT_NULL)
723+
*used = _heap.pool_size - _heap.available_size;
724+
725+
if (max_used != RT_NULL)
726+
*max_used = _heap.max_used_size;
727+
}
728+
715729
#endif
716730

717731
#endif

0 commit comments

Comments
 (0)