py/malloc: Introduce m_tracked_calloc, m_tracked_free functions.
Enabled by MICROPY_TRACKED_ALLOC. Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
@@ -103,6 +103,13 @@ void m_free(void *ptr);
|
||||
#endif
|
||||
NORETURN void m_malloc_fail(size_t num_bytes);
|
||||
|
||||
#if MICROPY_TRACKED_ALLOC
|
||||
// These alloc/free functions track the pointers in a linked list so the GC does not reclaim
|
||||
// them. They can be used by code that requires traditional C malloc/free semantics.
|
||||
void *m_tracked_calloc(size_t nmemb, size_t size);
|
||||
void m_tracked_free(void *ptr_in);
|
||||
#endif
|
||||
|
||||
#if MICROPY_MEM_STATS
|
||||
size_t m_get_total_bytes_allocated(void);
|
||||
size_t m_get_current_bytes_allocated(void);
|
||||
|
||||
Reference in New Issue
Block a user