summaryrefslogtreecommitdiff
path: root/py/misc.h
diff options
context:
space:
mode:
authorJim Mussared <jim.mussared@gmail.com>2022-09-13 23:56:52 +1000
committerDamien George <damien@micropython.org>2022-09-19 19:06:13 +1000
commit165388e4eb5db1207f4d839abe77d417d4c3f7c3 (patch)
tree45f6ef5aaca5b8d51fde3a48d0287a02264cc2eb /py/misc.h
parentcb0ffdd2bf25dcac3c230bdc1168d492aabaf573 (diff)
py/objtype: Optimise slot RAM usage for instance types.
In all cases other than where you have a native base with a protocol, it now fits into 4 GC blocks (like it did before the slots representation). Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Diffstat (limited to 'py/misc.h')
-rw-r--r--py/misc.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/py/misc.h b/py/misc.h
index 134325f89..7350d2f9b 100644
--- a/py/misc.h
+++ b/py/misc.h
@@ -72,6 +72,7 @@ typedef unsigned int uint;
#define m_new_obj(type) (m_new(type, 1))
#define m_new_obj_maybe(type) (m_new_maybe(type, 1))
#define m_new_obj_var(obj_type, var_type, var_num) ((obj_type *)m_malloc(sizeof(obj_type) + sizeof(var_type) * (var_num)))
+#define m_new_obj_var0(obj_type, var_type, var_num) ((obj_type *)m_malloc0(sizeof(obj_type) + sizeof(var_type) * (var_num)))
#define m_new_obj_var_maybe(obj_type, var_type, var_num) ((obj_type *)m_malloc_maybe(sizeof(obj_type) + sizeof(var_type) * (var_num)))
#if MICROPY_ENABLE_FINALISER
#define m_new_obj_with_finaliser(type) ((type *)(m_malloc_with_finaliser(sizeof(type))))