Add a new API to get free memory in memory pool (#1430)

This commit is contained in:
Huang Qi
2022-08-31 16:39:25 +08:00
committed by GitHub
parent e0c2acd178
commit 77c516ac80
4 changed files with 32 additions and 0 deletions

View File

@ -69,6 +69,13 @@ mem_allocator_is_heap_corrupted(mem_allocator_t allocator)
return gc_is_heap_corrupted((gc_handle_t)allocator);
}
bool
mem_allocator_get_alloc_info(mem_allocator_t allocator, void *mem_alloc_info)
{
gc_heap_stats((gc_handle_t)allocator, mem_alloc_info, 3);
return true;
}
#else /* else of DEFAULT_MEM_ALLOCATOR */
#include "tlsf/tlsf.h"

View File

@ -45,6 +45,9 @@ mem_allocator_migrate(mem_allocator_t allocator, char *pool_buf_new,
bool
mem_allocator_is_heap_corrupted(mem_allocator_t allocator);
bool
mem_allocator_get_alloc_info(mem_allocator_t allocator, void *mem_alloc_info);
#ifdef __cplusplus
}
#endif