mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-23 20:15:05 +02:00
Temporary (?) failsafe in gc_sweep
Also account for collector's mark color when sweeping old objects. Sucks to have to make 3 comparisons but its better than risking accidentally freeing a traced object!
This commit is contained in:
parent
bcb680f7f6
commit
5216131309
1 changed files with 3 additions and 1 deletions
4
gc.c
4
gc.c
|
@ -1562,6 +1562,7 @@ gc_heap *gc_sweep(gc_heap * h, int heap_type, gc_thread_data *thd)
|
||||||
gc_heap *orig_heap_ptr = h;
|
gc_heap *orig_heap_ptr = h;
|
||||||
#endif
|
#endif
|
||||||
gc_heap *rv = h;
|
gc_heap *rv = h;
|
||||||
|
int markColor = ck_pr_load_8(&gc_color_mark);
|
||||||
|
|
||||||
//h->next_free = h;
|
//h->next_free = h;
|
||||||
h->last_alloc_size = 0;
|
h->last_alloc_size = 0;
|
||||||
|
@ -1619,7 +1620,8 @@ gc_heap *gc_sweep(gc_heap * h, int heap_type, gc_thread_data *thd)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (mark(p) != thd->gc_alloc_color &&
|
if (mark(p) != markColor &&
|
||||||
|
mark(p) != thd->gc_alloc_color &&
|
||||||
mark(p) != thd->gc_trace_color) { //gc_color_clear)
|
mark(p) != thd->gc_trace_color) { //gc_color_clear)
|
||||||
#if GC_DEBUG_VERBOSE
|
#if GC_DEBUG_VERBOSE
|
||||||
fprintf(stderr, "sweep is freeing unmarked obj: %p with tag %d mark %d - alloc color %d trace color %d\n", p,
|
fprintf(stderr, "sweep is freeing unmarked obj: %p with tag %d mark %d - alloc color %d trace color %d\n", p,
|
||||||
|
|
Loading…
Add table
Reference in a new issue