init lserp cs 5.0
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Zhaizj.Framework.Utils
|
||||
{
|
||||
/// <summary>
|
||||
/// 用于释放内存垃圾,即时释放
|
||||
/// </summary>
|
||||
public class GCFlash
|
||||
{
|
||||
[DllImport("kernel32.dll")]
|
||||
public static extern bool SetProcessWorkingSetSize(IntPtr proc, int min, int max);
|
||||
public static void FlushMemory()
|
||||
{
|
||||
|
||||
GC.Collect();
|
||||
GC.WaitForPendingFinalizers();
|
||||
if (Environment.OSVersion.Platform == PlatformID.Win32NT)
|
||||
{
|
||||
SetProcessWorkingSetSize(System.Diagnostics.Process.GetCurrentProcess().Handle, -1, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user