diff options
| author | Bernard Xiong <[email protected]> | 2020-12-30 17:21:26 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-12-30 17:21:26 +0800 |
| commit | 4c399f88bb15416e833e9b86ad9de46807ca12e0 (patch) | |
| tree | a7db2443e8409bf1304291c583498340364ba6e8 /src | |
| parent | 4529e9a741f7a1b0b4c822087d06dae43b22e197 (diff) | |
| parent | b71a0eb1d433530046fba732d0a506de7a67a6ee (diff) | |
Merge pull request #4192 from Jedcheen/master
add rt_memory_info() for memheap.c
Diffstat (limited to 'src')
| -rw-r--r-- | src/memheap.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/memheap.c b/src/memheap.c index 0ff6925696..afa06fb9bf 100644 --- a/src/memheap.c +++ b/src/memheap.c @@ -712,6 +712,20 @@ void *rt_calloc(rt_size_t count, rt_size_t size) } RTM_EXPORT(rt_calloc); +void rt_memory_info(rt_uint32_t *total, + rt_uint32_t *used, + rt_uint32_t *max_used) +{ + if (total != RT_NULL) + *total = _heap.pool_size; + + if (used != RT_NULL) + *used = _heap.pool_size - _heap.available_size; + + if (max_used != RT_NULL) + *max_used = _heap.max_used_size; +} + #endif #endif |
