From 0bb5d2d1e1e1d18540f38c3713def2f8fe421607 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=B6ller?= Date: Sat, 25 Jun 2011 14:46:28 +0000 Subject: [PATCH] Changed the maximum buffer size for double buffering of controls that isn't disposed after each draw call to the size of the screen. This should reduce the memory allocation and disposing on each sensor update. Also page faults are no longer increasing with this change. --- GUI/MainForm.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/GUI/MainForm.cs b/GUI/MainForm.cs index 67057da..f35432c 100644 --- a/GUI/MainForm.cs +++ b/GUI/MainForm.cs @@ -99,6 +99,11 @@ namespace OpenHardwareMonitor.GUI { this.unitManager = new UnitManager(settings); + // make sure the buffers used for double buffering are not disposed + // after each draw call + BufferedGraphicsManager.Current.MaximumBuffer = + Screen.PrimaryScreen.Bounds.Size; + // set the DockStyle here, to avoid conflicts with the MainMenu this.splitContainer.Dock = DockStyle.Fill; @@ -258,7 +263,7 @@ namespace OpenHardwareMonitor.GUI { // Make sure the settings are saved when the user logs off Microsoft.Win32.SystemEvents.SessionEnded += delegate { SaveConfiguration(); - }; + }; } private void InitializePlotForm() {