on master help sign in
Merge pull request #1967 from Chobbes/gc_malloc
446d99dEdwin Brady
rts/idris_gc.c+8
@@ -115,6 +115,14 @@ void idris_gc(VM* vm) {
115 char* newheap = malloc(vm->heap.size);
115 char* newheap = malloc(vm->heap.size);
116 char* oldheap = vm->heap.heap;
116 char* oldheap = vm->heap.heap;
117
117
118+ if (newheap == NULL) {
119+ fprintf(stderr,
120+ "GC ERROR: Unable to allocate new heap. Requested %zd bytes.\n",
121+ vm->heap.size);
122+
123+ exit(EXIT_FAILURE);
124+ }
125+
118 vm->heap.heap = newheap;
126 vm->heap.heap = newheap;
119#ifdef FORCE_ALIGNMENT
127#ifdef FORCE_ALIGNMENT
120 if (((i_int)(vm->heap.heap)&1) == 1) {
128 if (((i_int)(vm->heap.heap)&1) == 1) {