Skip to content

Commit 828df54

Browse files
Colin Hogbendpgeorge
authored andcommitted
py: Change config default so m_malloc0 uses memset if GC not enabled.
With MICROPY_ENABLE_GC set to false the alternate memory manager may not clear all memory that is allocated, so it must be cleared in m_malloc0.
1 parent 94aeba0 commit 828df54

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

py/mpconfig.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,11 @@
110110
// Be conservative and always clear to zero newly (re)allocated memory in the GC.
111111
// This helps eliminate stray pointers that hold on to memory that's no longer
112112
// used. It decreases performance due to unnecessary memory clearing.
113+
// A memory manager which always clears memory can set this to 0.
113114
// TODO Do analysis to understand why some memory is not properly cleared and
114115
// find a more efficient way to clear it.
115116
#ifndef MICROPY_GC_CONSERVATIVE_CLEAR
116-
#define MICROPY_GC_CONSERVATIVE_CLEAR (1)
117+
#define MICROPY_GC_CONSERVATIVE_CLEAR (MICROPY_ENABLE_GC)
117118
#endif
118119

119120
// Support automatic GC when reaching allocation threshold,

0 commit comments

Comments
 (0)