Added pinned memory creation

* Moved pinned and alloc out of array class
* Memory leak fix from @orbitcowboy

Fixes #206