add heap finializer
This commit is contained in:
parent
1433698fe5
commit
db75df2624
|
@ -26,5 +26,6 @@ struct pic_heap {
|
|||
};
|
||||
|
||||
void init_heap(struct pic_heap *);
|
||||
void finalize_heap(struct pic_heap *);
|
||||
|
||||
#endif
|
||||
|
|
12
src/gc.c
12
src/gc.c
|
@ -34,6 +34,18 @@ init_heap(struct pic_heap *heap)
|
|||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
finalize_heap(struct pic_heap *heap)
|
||||
{
|
||||
struct heap_page *page;
|
||||
|
||||
while (heap->pages) {
|
||||
page = heap->pages;
|
||||
heap->pages = heap->pages->next;
|
||||
free(page);
|
||||
}
|
||||
}
|
||||
|
||||
static void gc_free(pic_state *, union header *);
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in New Issue