BUG: fix leak and possible use-after-free
ENH: implement may_share_memory in C

memmap needs to call it in __array_finalize__ to determine if it can
drop the references on copies.
The python version if may_share_memory caused significant slowdowns when
slicing these maps.

closes gh-3364
ENH: improve performance of byte_bounds for continous arrays