Figuring out how to intelligently allocate and deallocate