内存优化 #3632 图形化时内存占用100+,后台运行时内存占用10+

This commit is contained in:
fonaix 2023-04-07 20:27:53 +08:00
parent 52b84c3201
commit c2d0d619ac
2 changed files with 6 additions and 2 deletions

View file

@ -1,4 +1,5 @@
using System.Windows; using Lierda.WPFHelper;
using System.Windows;
using System.Windows.Threading; using System.Windows.Threading;
using v2rayN.Handler; using v2rayN.Handler;
using v2rayN.Mode; using v2rayN.Mode;
@ -13,6 +14,7 @@ namespace v2rayN
{ {
public static EventWaitHandle ProgramStarted; public static EventWaitHandle ProgramStarted;
private static Config _config; private static Config _config;
LierdaCracker lierdaCracker=new LierdaCracker();
public App() public App()
{ {
@ -28,6 +30,7 @@ namespace v2rayN
/// <param name="e"></param> /// <param name="e"></param>
protected override void OnStartup(StartupEventArgs e) protected override void OnStartup(StartupEventArgs e)
{ {
lierdaCracker.Cracker(30); //内存回收每30秒回收一次
Global.ExePathKey = Utils.GetMD5(Utils.GetExePath()); Global.ExePathKey = Utils.GetMD5(Utils.GetExePath());
var rebootas = (e.Args ?? new string[] { }).Any(t => t == Global.RebootAs); var rebootas = (e.Args ?? new string[] { }).Any(t => t == Global.RebootAs);

View file

@ -15,6 +15,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Downloader" Version="3.0.4" /> <PackageReference Include="Downloader" Version="3.0.4" />
<PackageReference Include="Lierda.WPFHelper" Version="1.0.3" />
<PackageReference Include="MaterialDesignThemes" Version="4.7.1" /> <PackageReference Include="MaterialDesignThemes" Version="4.7.1" />
<PackageReference Include="H.NotifyIcon.Wpf" Version="2.0.108" /> <PackageReference Include="H.NotifyIcon.Wpf" Version="2.0.108" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />