Skip to content

Commit

Permalink
try to reduce memory usage
Browse files Browse the repository at this point in the history
patch tab in particular #268
  • Loading branch information
Lord-Zedd committed Feb 2, 2020
1 parent b7fab2f commit 2747a64
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1913,6 +1913,12 @@ public void Dispose()

ExternalTabsClose(tabs, false);

_stringIdTrie = null;

_tagEntries.Clear();
_allTags.Entries.Clear();
_visibleTags.Entries.Clear();

//check for any viewvalueas dialogs that rely on this cache and close them
foreach (Window w in Application.Current.Windows)
{
Expand Down
13 changes: 9 additions & 4 deletions src/Assembly/Metro/Controls/PageTemplates/PatchControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -804,10 +804,6 @@ private void btnExtractInfo_Click(object sender, RoutedEventArgs e)

#endregion

#region Patch Convertion Functions

#endregion

#region Patch Poking Functions

private Patch currentPatchToPoke;
Expand Down Expand Up @@ -1021,5 +1017,14 @@ private void LoadPatchToPoke()
#endregion

// ReSharper restore UnusedMember.Global

public void Dispose()
{
if (currentPatch != null && currentPatch.SegmentChanges != null)
currentPatch.SegmentChanges.Clear();

if (currentPatchToPoke != null && currentPatchToPoke.SegmentChanges != null)
currentPatchToPoke.SegmentChanges.Clear();
}
}
}
9 changes: 9 additions & 0 deletions src/Assembly/Windows/Home.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,7 @@ public void AddPatchTabModule(string patchLocation = null)
Content = (patchLocation != null) ? new PatchControl(patchLocation) : new PatchControl()
};
documentManager.Children.Add(newPatchTab);
newPatchTab.Closing += PatchControl_Closing;
documentManager.SelectedContentIndex = documentManager.IndexOfChild(newPatchTab);
}

Expand Down Expand Up @@ -915,5 +916,13 @@ private void HaloMap_Closing(object sender, CancelEventArgs e)

mp.Dispose();
}

private void PatchControl_Closing(object sender, CancelEventArgs e)
{
LayoutDocument ld = (LayoutDocument)sender;
PatchControl mp = (PatchControl)ld.Content;

mp.Dispose();
}
}
}

0 comments on commit 2747a64

Please sign in to comment.