@@ -143,7 +143,10 @@ int space(VM* vm, size_t size) {
145void* idris_alloc(size_t size) {
145void* idris_alloc(size_t size) {
146− return allocate(size, 0);
146+ Closure* cl = (Closure*) allocate(sizeof(Closure)+size, 0);
148+ cl->info.size = size;
149+ return (void*)cl+sizeof(Closure);
149void* idris_realloc(void* old, size_t old_size, size_t size) {
152void* idris_realloc(void* old, size_t old_size, size_t size) {
@@ -712,6 +715,13 @@ VAL doCopyTo(VM* vm, VAL x) {
712 case BITS64:
715 case BITS64:
713 cl = idris_b64CopyForGC(vm, x);
716 cl = idris_b64CopyForGC(vm, x);
720+ size_t size = x->info.size + sizeof(Closure);
721+ cl = allocate(size, 0);
722+ memcpy(cl, x, size);
716 assert(0); // We're in trouble if this happens...
726 assert(0); // We're in trouble if this happens...