From c706d4f326b207d3ad54ee91b8fc361fd869263c Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Mon, 14 Oct 2013 17:34:04 +0900 Subject: [PATCH] sweep objects from base pointer (not from freep) --- src/gc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gc.c b/src/gc.c index b82a95d0..d3086b63 100644 --- a/src/gc.c +++ b/src/gc.c @@ -212,10 +212,12 @@ gc_finalize_object(pic_state *pic, struct pic_object *obj) static void gc_sweep_phase(pic_state *pic) { - union header *freep, *bp, *p; + union header *base, *bp, *p; freep = pic->heap->freep; for (p = freep; p != freep; p = p->s.ptr) { + base = pic->heap->base; + for (p = base->s.ptr; p != base; p = p->s.ptr) { for (bp = p + p->s.size; bp != p->s.ptr; bp += bp->s.size) { if (is_marked(bp)) { gc_unmark(bp);