Initial commit of mem.h, which should have all basic functionality
exported to clients.