mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-25 13:05:05 +02:00
Fix crash on 32-bit systems
This commit is contained in:
parent
ddefaa4167
commit
5810b7c035
2 changed files with 7 additions and 4 deletions
5
gc.c
5
gc.c
|
@ -1417,9 +1417,12 @@ void gc_collector()
|
||||||
//sweep :
|
//sweep :
|
||||||
|
|
||||||
for (heap_type = 0; heap_type < NUM_HEAP_TYPES; heap_type++) {
|
for (heap_type = 0; heap_type < NUM_HEAP_TYPES; heap_type++) {
|
||||||
gc_sweep(gc_get_heap()->heap[heap_type], heap_type, &freed_tmp);
|
gc_heap *h = gc_get_heap()->heap[heap_type];
|
||||||
|
if (h) {
|
||||||
|
gc_sweep(h, heap_type, &freed_tmp);
|
||||||
freed += freed_tmp;
|
freed += freed_tmp;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: this loop only includes smallest 2 heaps, is that sufficient??
|
// TODO: this loop only includes smallest 2 heaps, is that sufficient??
|
||||||
for (heap_type = 0; heap_type < 2; heap_type++) {
|
for (heap_type = 0; heap_type < 2; heap_type++) {
|
||||||
|
|
|
@ -262,8 +262,8 @@ static bool set_insert(ck_hs_t * hs, const void *value)
|
||||||
void gc_init_heap(long heap_size)
|
void gc_init_heap(long heap_size)
|
||||||
{
|
{
|
||||||
size_t initial_heap_size = INITIAL_HEAP_SIZE;
|
size_t initial_heap_size = INITIAL_HEAP_SIZE;
|
||||||
Cyc_heap = malloc(sizeof(gc_heap_root));
|
Cyc_heap = calloc(1, sizeof(gc_heap_root));
|
||||||
Cyc_heap->heap = malloc(sizeof(gc_heap *) * NUM_HEAP_TYPES);
|
Cyc_heap->heap = calloc(1, sizeof(gc_heap *) * NUM_HEAP_TYPES);
|
||||||
Cyc_heap->heap[HEAP_REST] = gc_heap_create(HEAP_REST, initial_heap_size, 0, 0);
|
Cyc_heap->heap[HEAP_REST] = gc_heap_create(HEAP_REST, initial_heap_size, 0, 0);
|
||||||
Cyc_heap->heap[HEAP_SM] = gc_heap_create(HEAP_SM, initial_heap_size, 0, 0);
|
Cyc_heap->heap[HEAP_SM] = gc_heap_create(HEAP_SM, initial_heap_size, 0, 0);
|
||||||
Cyc_heap->heap[HEAP_64] = gc_heap_create(HEAP_64, initial_heap_size, 0, 0);
|
Cyc_heap->heap[HEAP_64] = gc_heap_create(HEAP_64, initial_heap_size, 0, 0);
|
||||||
|
|
Loading…
Add table
Reference in a new issue