From 157841f9db17b382e91db5402365ccec40b7eaa4 Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Mon, 13 Mar 2023 13:38:01 +0000 Subject: [PATCH] MicroPython: Add tracked alloc/free class helpers. --- micropython/modules/util.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/micropython/modules/util.hpp b/micropython/modules/util.hpp index 6765de9f..75db4d94 100644 --- a/micropython/modules/util.hpp +++ b/micropython/modules/util.hpp @@ -13,4 +13,7 @@ #define m_new_class(cls, ...) new(m_new(cls, 1)) cls(__VA_ARGS__) -#define m_del_class(cls, ptr) ptr->~cls();m_del(cls, ptr, 1) \ No newline at end of file +#define m_del_class(cls, ptr) ptr->~cls();m_del(cls, ptr, 1) + +#define m_tracked_alloc_class(cls, ...) new(m_tracked_calloc(1, sizeof(cls))) cls(__VA_ARGS__) +#define m_tracked_free_class(cls, ptr) ptr->~cls();m_tracked_free(ptr) \ No newline at end of file