public static void ClearMemory() { GC.Collect(); GC.WaitForPendingFinalizers(); bool flag = Environment.OSVersion.Platform == PlatformID.Win32NT; if (flag) { RecMemory.SetProcessWorkingSetSize(Process.GetCurrentProcess().Handle, -1, -1); } }
/// <summary> /// 定时更换图片,实现转动 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void timer_Tick(object sender, EventArgs e) { if (this.VarValue == "1") { //如果变量值为1,则执行转动 if (frame++ <= 11) { this.Change(); RecMemory.ClearMemory(); } else { frame = 1; this.Change(); RecMemory.ClearMemory(); } } }