Allocates memory of the given size to hold a struct and returns a Memory to read from and write to it.