Efficient realloc: only copy data in touched spaces
Thanks @robinson96, I'll write up some more test cases and check that this all works.
One other concern - by choosing not to do a realloc on the CPU side of things, you're forcing a copy to always happen, while most realloc implementations will avoid a copy if the realloc ends up with the same address (which happens pretty often, in my experience). Does Umpire have a realloc API? Should it?
It does, but that means we can't avoid the unnecessary copies on the CPU side - you call realloc and the semantics of realloc are what you will get. If you only want to avoid a device-side copy then that would be fine.