diff --git a/src/gc.c b/src/gc.c index a1ebef63..8e294ff7 100644 --- a/src/gc.c +++ b/src/gc.c @@ -188,7 +188,7 @@ gc_finalize_object(pic_state *pic, struct pic_object *obj) case PIC_TT_SYMBOL: { char *name; name = ((struct pic_symbol *)obj)->name; - free(name); + pic_free(pic, name); break; } case PIC_TT_PAIR: { @@ -200,8 +200,8 @@ gc_finalize_object(pic_state *pic, struct pic_object *obj) proc = (struct pic_proc *)obj; /* free irep */ - free(proc->u.irep->code); - free(proc->u.irep); + pic_free(pic, proc->u.irep->code); + pic_free(pic, proc->u.irep); } default: pic_raise(pic, "logic flaw"); diff --git a/src/symbol.c b/src/symbol.c index fcab59db..646822f6 100644 --- a/src/symbol.c +++ b/src/symbol.c @@ -13,7 +13,7 @@ pic_intern_cstr(pic_state *pic, const char *name) /* clone name string */ len = strlen(name); - sym->name = (char *)malloc(len + 1); + sym->name = (char *)pic_alloc(pic, len + 1); strncpy(sym->name, name, len + 1); return pic_obj_value(sym); diff --git a/src/vm.c b/src/vm.c index cc601aff..df79f550 100644 --- a/src/vm.c +++ b/src/vm.c @@ -140,8 +140,8 @@ pic_codegen(pic_state *pic, pic_value obj, struct pic_env *env) proc = (struct pic_proc *)pic_obj_alloc(pic, sizeof(struct pic_proc), PIC_TT_PROC); - proc->u.irep = irep = (struct pic_irep *)malloc(sizeof(struct pic_irep)); - irep->code = code = (struct pic_code *)malloc(sizeof(struct pic_code) * 1024); + proc->u.irep = irep = (struct pic_irep *)pic_alloc(pic, sizeof(struct pic_irep)); + irep->code = code = (struct pic_code *)pic_alloc(pic, sizeof(struct pic_code) * 1024); irep->clen = 0; irep->ccapa = 1024;