summaryrefslogtreecommitdiffstatshomepage
path: root/py/malloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'py/malloc.c')
-rw-r--r--py/malloc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/py/malloc.c b/py/malloc.c
index db2578d9ad..76c3fe6cad 100644
--- a/py/malloc.c
+++ b/py/malloc.c
@@ -88,9 +88,13 @@ void *m_malloc_with_finaliser(int num_bytes) {
void *m_malloc0(int num_bytes) {
void *ptr = m_malloc(num_bytes);
+#if MICROPY_ENABLE_GC
+ // the GC already zeros out all memory
+#else
if (ptr != NULL) {
memset(ptr, 0, num_bytes);
}
+#endif
return ptr;
}