From 0c1e4212c027ad9d41e6a6bccce7462ccd703dfd Mon Sep 17 00:00:00 2001 From: Carglglz Date: Thu, 30 May 2024 17:59:50 +0100 Subject: feat(micropython): improve mem core micropython (#6219) --- src/stdlib/micropython/lv_mem_core_micropython.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/stdlib/micropython/lv_mem_core_micropython.c') diff --git a/src/stdlib/micropython/lv_mem_core_micropython.c b/src/stdlib/micropython/lv_mem_core_micropython.c index 69c8bd681..a671b5e1c 100644 --- a/src/stdlib/micropython/lv_mem_core_micropython.c +++ b/src/stdlib/micropython/lv_mem_core_micropython.c @@ -62,17 +62,32 @@ void lv_mem_remove_pool(lv_mem_pool_t pool) void * lv_malloc_core(size_t size) { +#if MICROPY_MALLOC_USES_ALLOCATED_SIZE + return gc_alloc(size, true); +#else return m_malloc(size); +#endif } void * lv_realloc_core(void * p, size_t new_size) { + +#if MICROPY_MALLOC_USES_ALLOCATED_SIZE + return gc_realloc(p, new_size, true); +#else return m_realloc(p, new_size); +#endif } void lv_free_core(void * p) { + +#if MICROPY_MALLOC_USES_ALLOCATED_SIZE + gc_free(p); + +#else m_free(p); +#endif } void lv_mem_monitor_core(lv_mem_monitor_t * mon_p) -- cgit v1.2.3