添加项目文件。

This commit is contained in:
Administrator
2026-08-06 09:23:30 +08:00
parent 771e23e00a
commit 4660ceee70
604 changed files with 138380 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
using System;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
namespace JinYuan.Helper
{
public class ClearMemoryHelper
{
[DllImport("kernel32.dll")]
private static extern bool SetProcessWorkingSetSize(IntPtr proc, int min, int max);
/// <summary>
/// 释放内存
/// </summary>
public static void ClearMemory()
{
Task.Run(async () =>
{
while (true)
{
await Task.Delay(4000);
GC.Collect();
GC.WaitForPendingFinalizers();
if (Environment.OSVersion.Platform == PlatformID.Win32NT)
{
SetProcessWorkingSetSize(System.Diagnostics.Process.GetCurrentProcess().Handle, -1, -1);
}
}
});
}
}
}