Implement pinned memory
Fixes
Perf fix
Hopefully better perf now