optimize<*>: reduce memory usage

This commit is contained in:
leo 2024-02-20 18:27:59 +08:00
parent ca19d65f0e
commit 57c4a8394c
8 changed files with 99 additions and 16 deletions

View file

@ -114,6 +114,24 @@ namespace SourceGit.ViewModels {
_repo = repo;
}
public void Cleanup() {
_repo = null;
_commit = null;
if (_changes != null) _changes.Clear();
if (_visibleChanges != null) _visibleChanges.Clear();
if (_changeTree != null) _changeTree.Clear();
_selectedChange = null;
_selectedChangeNode = null;
_searchChangeFilter = null;
_diffContext = null;
if (_revisionFiles != null) _revisionFiles.Clear();
if (_revisionFilesTree != null) _revisionFilesTree.Clear();
_selectedRevisionFileNode = null;
_searchFileFilter = null;
_viewRevisionFileContent = null;
_cancelToken = null;
}
public void NavigateTo(string commitSHA) {
var repo = Preference.FindRepository(_repo);
if (repo != null) repo.NavigateToCommit(commitSHA);