aboutsummaryrefslogtreecommitdiff
path: root/stmhal/gccollect.c
diff options
context:
space:
mode:
Diffstat (limited to 'stmhal/gccollect.c')
-rw-r--r--stmhal/gccollect.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/stmhal/gccollect.c b/stmhal/gccollect.c
index e20e92de1..d40460d70 100644
--- a/stmhal/gccollect.c
+++ b/stmhal/gccollect.c
@@ -21,10 +21,9 @@ void gc_collect(void) {
// start the GC
gc_collect_start();
- // scan everything in RAM before the heap
- // this includes the data and bss segments
- // TODO possibly don't need to scan data, since all pointers should start out NULL and be in bss
- gc_collect_root((void**)&_ram_start, ((uint32_t)&_ebss - (uint32_t)&_ram_start) / sizeof(uint32_t));
+ // We need to scan everything in RAM that can hold a pointer.
+ // The data segment is used, but should not contain pointers, so we just scan the bss.
+ gc_collect_root((void**)&_sbss, ((uint32_t)&_ebss - (uint32_t)&_sbss) / sizeof(uint32_t));
// get the registers and the sp
machine_uint_t regs[10];