perf: adding manual gc ensures a very small memory footprint

dev_settings
DESKTOP-3BO4HSG\ksat 2 years ago
parent c0643c40e9
commit a91965a75d

@ -18,6 +18,8 @@ namespace STranslate
if (mutex.WaitOne(0, false)) if (mutex.WaitOne(0, false))
{ {
base.OnStartup(e); base.OnStartup(e);
Util.Util.FlushMemory();
} }
else else
{ {

@ -68,6 +68,8 @@ namespace STranslate.ViewModel
if (IsTopmost) return; if (IsTopmost) return;
_speech.SpeakAsyncCancelAll(); _speech.SpeakAsyncCancelAll();
Mainwin.Hide(); Mainwin.Hide();
Util.Util.FlushMemory();
}); });
//source speak //source speak
SourceSpeakCmd = new RelayCommand((_) => true, (_) => SourceSpeakCmd = new RelayCommand((_) => true, (_) =>
@ -134,6 +136,7 @@ namespace STranslate.ViewModel
LargeHumpRet = string.Empty; LargeHumpRet = string.Empty;
IdentifyLanguage = string.Empty; IdentifyLanguage = string.Empty;
Util.Util.FlushMemory();
} }
/// <summary> /// <summary>
/// 打开主窗口 /// 打开主窗口
@ -189,6 +192,7 @@ namespace STranslate.ViewModel
/// </summary> /// </summary>
public void ExitApp(int id) public void ExitApp(int id)
{ {
Util.Util.FlushMemory();
Mainwin.NotifyIcon.Dispose(); Mainwin.NotifyIcon.Dispose();
Mainwin.Close(); Mainwin.Close();
//语音合成销毁 //语音合成销毁

Loading…
Cancel
Save