add_heap_page should not be invoked in gc_alloc, but should be in obj_alloc
This commit is contained in:
parent
df20de5285
commit
f11623f075
10
src/gc.c
10
src/gc.c
|
@ -139,8 +139,7 @@ gc_alloc(pic_state *pic, size_t size)
|
|||
if (p->s.size >= nunits)
|
||||
break;
|
||||
if (p == freep) {
|
||||
if ((p = add_heap_page(pic)) == NULL)
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (p->s.size == nunits) {
|
||||
|
@ -494,8 +493,11 @@ pic_obj_alloc_unsafe(pic_state *pic, size_t size, enum pic_tt tt)
|
|||
if (obj == NULL) {
|
||||
pic_gc_run(pic);
|
||||
obj = (struct pic_object *)gc_alloc(pic, size);
|
||||
if (obj == NULL)
|
||||
pic_abort(pic, "GC memory exhausted");
|
||||
if (obj == NULL) {
|
||||
if (add_heap_page(pic) == NULL)
|
||||
pic_abort(pic, "GC memory exhausted");
|
||||
obj = (struct pic_object *)gc_alloc(pic, size);
|
||||
}
|
||||
}
|
||||
obj->tt = tt;
|
||||
|
||||
|
|
Loading…
Reference in New Issue