I think the code may have align problem in 2 respects:
1) line 336: _memory is not the aligned address which is previously returned by align-function.
The function create_view is only called when reusing the image's memory. I guess I don't understand what you mean.
2) In 'recreate': You have to update _align_in_bytes before calling create_view
When the user recreates an image with a different _align_in_bytes we need to reallocate the memory. I added this condition to the code. If the alignment doesn't change then I don't need to update the member.
BTW, why is the 3rd overload of recreate kept unmodified?
Good question! For whatever reason I thought it takes in a memory pointer. But on a closer look it I realize that's nonsense. I have added the new code. Thanks for helping out! Christian