summaryrefslogtreecommitdiffstatshomepage
path: root/py/malloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'py/malloc.c')
-rw-r--r--py/malloc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/py/malloc.c b/py/malloc.c
index b0493d9341..f48cb8da4f 100644
--- a/py/malloc.c
+++ b/py/malloc.c
@@ -117,7 +117,10 @@ void *m_malloc0(size_t num_bytes) {
if (ptr == NULL && num_bytes != 0) {
return m_malloc_fail(num_bytes);
}
+ // If this config is set then the GC clears all memory, so we don't need to.
+ #if !MICROPY_GC_CONSERVATIVE_CLEAR
memset(ptr, 0, num_bytes);
+ #endif
return ptr;
}