on master help sign in
Fix GC heap sizing
ac930f3Edwin Brady
rts/idris_rts.c+7
@@ -242,6 +242,13 @@ void* iallocate(VM * vm, size_t isize, int outerlock) {
242 vm->heap.size += size;
242 vm->heap.size += size;
243 }
243 }
244 idris_gc(vm);
244 idris_gc(vm);
245+
246+ // If there's still not enough room, grow the heap and try again
247+ if (vm->heap.next + size >= vm->heap.end) {
248+ vm->heap.size += size+vm->heap.growth;
249+ idris_gc(vm);
250+ }
251+
245#ifdef HAS_PTHREAD
252#ifdef HAS_PTHREAD
246 if (lock) { // not message passing
253 if (lock) { // not message passing
247 pthread_mutex_unlock(&vm->alloc_lock);
254 pthread_mutex_unlock(&vm->alloc_lock);