//开启新的实例
System.Diagnostics.Process.Start(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName);
System.Threading.Thread.Sleep(5000);
//关闭当前实例
System.Diagnostics.Process.GetCurrentProcess().Kill();
Resources.UnloadUnusedAssets();
//GC.GetTotalMemory(true);
GC.Collect();
// GC.WaitForPendingFinalizers();
//把占用的内存转到虚拟内存里去
// SetProcessWorkingSetSize(System.Diagnostics.Process.GetCurrentProcess().Handle, -1, -1);
//垃圾回收
/// <summary>
///设置线程工作的空间
/// </summary>
/// <param name="process">线程</param>
/// <param name="minSize">最小空间</param>
/// <param name="maxSize">最大空间</param>
/// <returns></returns>
[DllImport("kernel32.dll", EntryPoint = "SetProcessWorkingSetSize")]
public static extern int SetProcessWorkingSetSize(IntPtr process, int minSize, int maxSize);