Can this alloc be moved out of the loop? allocs are expensive