summaryrefslogtreecommitdiffstatshomepage
path: root/esp8266/gccollect.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2016-12-20 11:20:01 +1100
committerDamien George <damien.p.george@gmail.com>2016-12-20 11:20:01 +1100
commit0d32f1aeb3e3792f2bd04c499a6d5a22c2efdf0c (patch)
tree4751284f824c8acde7e6efc93cda1038c973009b /esp8266/gccollect.c
parent5e1ccddc825e1304dbf235e391df3e1a5aea0723 (diff)
downloadmicropython-0d32f1aeb3e3792f2bd04c499a6d5a22c2efdf0c.tar.gz
micropython-0d32f1aeb3e3792f2bd04c499a6d5a22c2efdf0c.zip
esp8266: When doing GC be sure to trace the memory holding native code.
Native code can hold pointers to objects on the heap, eg constant objects like big integers.
Diffstat (limited to 'esp8266/gccollect.c')
-rw-r--r--esp8266/gccollect.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/esp8266/gccollect.c b/esp8266/gccollect.c
index 3a5032bc93..1b9349f574 100644
--- a/esp8266/gccollect.c
+++ b/esp8266/gccollect.c
@@ -46,6 +46,11 @@ void gc_collect(void) {
// trace the stack, including the registers (since they live on the stack in this function)
gc_collect_root((void**)sp, (STACK_END - sp) / sizeof(uint32_t));
+ #if MICROPY_EMIT_XTENSA || MICROPY_EMIT_INLINE_XTENSA
+ // trace any native code because it can contain pointers to the heap
+ esp_native_code_gc_collect();
+ #endif
+
// end the GC
gc_collect_end();
}