Improve memory management in FilePersistence::Diff