From f0acc9c8106f26964bb4f6cb6c1e8e98b2b146ae Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Thu, 20 Jul 2017 18:57:27 -0400 Subject: [PATCH] WIP --- gc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gc.c b/gc.c index 989e9853..1cf9922f 100644 --- a/gc.c +++ b/gc.c @@ -306,15 +306,21 @@ gc_heap *gc_heap_create(int heap_type, size_t size, size_t max_size, * @brief Helper for initializing the "REST" heap for medium-sized objects * @param h Root of the heap */ -void gc_heap_create_rest(gc_heap *h) { +void gc_heap_create_rest(gc_heap *h, gc_thread_data *thd) { int i; + gc_heap *h_last = h; + size_t chunk_size = REST_HEAP_MIN_SIZE; h->next_frees = malloc(sizeof(gc_heap *) * 3); for (i = 0; i < 3; i++){ // TODO: just create heaps here instead? // TODO: don't forget to set chunk_size on them - h->next_frees[i] = h; + h->next_frees[i] = gc_heap_create(h->heap_type, h->size, h->max_size, chunk_size, thd); + h_last = h_last->next = h->next_frees[i]; + chunk_size += 32; } // TODO: not here, but need a new gc_grow_heap (and strategy) for REST heap!! + should be able to re-use gc_grow_heap but only account for sizes from pages with the + same chunk_size. need to make sure the new page is added at the very end too, of course } /**