Realize add to memory function.