WIP: Memory utility class.

Adds Memory class which contains common utility functions for memory
related tasks. Currently these are just templated wrappers for functions
found in standard C library.

Also adds some forgotten template magic in Handle class.