Migrate memory management

This is the start of migrating the C run-time to use the same memory management infrastructure as the HARP run-time.