work towards jit-ing preallocate function