add heap finializer

This commit is contained in:
Yuichi Nishiwaki 2014-01-16 22:02:30 +09:00
parent 1433698fe5
commit db75df2624
2 changed files with 13 additions and 0 deletions

View File

@ -26,5 +26,6 @@ struct pic_heap {
};
void init_heap(struct pic_heap *);
void finalize_heap(struct pic_heap *);
#endif

View File

@ -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