diff options
author | Damien George <damien@micropython.org> | 2022-05-04 12:12:11 +1000 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2022-05-05 10:31:50 +1000 |
commit | fca5701f74b784834d1af22d10988a1d0fddddaf (patch) | |
tree | f98c1d6c9e1473a13455857af0563760abcd08ec /py/misc.h | |
parent | 965747bd97183a85db56e8d79c15c589df87cdd6 (diff) |
py/malloc: Introduce m_tracked_calloc, m_tracked_free functions.
Enabled by MICROPY_TRACKED_ALLOC.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'py/misc.h')
-rw-r--r-- | py/misc.h | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -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); |