mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-23 20:15:05 +02:00
Grow heap more slowly
This commit is contained in:
parent
71d085091d
commit
1578127410
2 changed files with 26 additions and 24 deletions
42
gc.c
42
gc.c
|
@ -385,26 +385,28 @@ int gc_grow_heap(gc_heap *h, int heap_type, size_t size, size_t chunk_size)
|
|||
// but with boyer benchmarks there is more thrashing with this method,
|
||||
// so for now it is not used. If it is used again, the initial heaps will
|
||||
// need to start at a lower size (EG 1 MB).
|
||||
// {
|
||||
// size_t prev_size = 0;
|
||||
// new_size = 0;
|
||||
// h_last = h;
|
||||
// while (h_last->next) {
|
||||
// if (new_size < HEAP_SIZE){
|
||||
// new_size = prev_size + h_last->size;
|
||||
// prev_size = h_last->size;
|
||||
// } else {
|
||||
// new_size = HEAP_SIZE;
|
||||
// }
|
||||
// h_last = h_last->next;
|
||||
// }
|
||||
// if (new_size == 0)
|
||||
// new_size = h_last->size;
|
||||
// //fprintf(stderr, "Growing heap new page size = %zu\n", new_size);
|
||||
// }
|
||||
h_last = gc_heap_last(h);
|
||||
cur_size = h_last->size;
|
||||
new_size = cur_size; //gc_heap_align(((cur_size > size) ? cur_size : size) * 2);
|
||||
{
|
||||
size_t prev_size = 0 * 1024 * 1024;
|
||||
new_size = 0;
|
||||
h_last = h;
|
||||
while (h_last->next) {
|
||||
if (new_size < HEAP_SIZE){
|
||||
new_size = prev_size + h_last->size;
|
||||
prev_size = h_last->size;
|
||||
} else {
|
||||
new_size = HEAP_SIZE;
|
||||
}
|
||||
h_last = h_last->next;
|
||||
}
|
||||
if (new_size == 0)
|
||||
new_size = prev_size + h_last->size;
|
||||
//#if GC_DEBUG_TRACE
|
||||
fprintf(stderr, "Growing heap %d new page size = %zu\n", heap_type, new_size);
|
||||
//#endif
|
||||
}
|
||||
// h_last = gc_heap_last(h);
|
||||
// cur_size = h_last->size;
|
||||
// new_size = cur_size; //gc_heap_align(((cur_size > size) ? cur_size : size) * 2);
|
||||
// allocate larger pages if size will not fit on the page
|
||||
//new_size = gc_heap_align(((cur_size > size) ? cur_size : size));
|
||||
// Done with computing new page size
|
||||
|
|
|
@ -164,11 +164,11 @@ static bool set_insert(ck_hs_t *hs, const void *value)
|
|||
|
||||
void gc_init_heap(long heap_size)
|
||||
{
|
||||
|
||||
size_t initial_heap_size = 1 * 1024 * 1024;
|
||||
Cyc_heap = malloc(sizeof(gc_heap_root));
|
||||
Cyc_heap->heap = gc_heap_create(HEAP_REST, heap_size, 0, 0);
|
||||
Cyc_heap->small_obj_heap = gc_heap_create(HEAP_SM, heap_size, 0, 0);
|
||||
Cyc_heap->medium_obj_heap = gc_heap_create(HEAP_MED, heap_size, 0, 0);
|
||||
Cyc_heap->heap = gc_heap_create(HEAP_REST, initial_heap_size, 0, 0);
|
||||
Cyc_heap->small_obj_heap = gc_heap_create(HEAP_SM, initial_heap_size, 0, 0);
|
||||
Cyc_heap->medium_obj_heap = gc_heap_create(HEAP_MED, initial_heap_size, 0, 0);
|
||||
|
||||
if (!ck_hs_init(&symbol_table,
|
||||
CK_HS_MODE_OBJECT | CK_HS_MODE_SPMC,
|
||||
|
|
Loading…
Add table
Reference in a new issue