1.1 --- a/Hardware/Sensor.cs Mon Jul 02 21:14:40 2012 +0000
1.2 +++ b/Hardware/Sensor.cs Sun Jul 08 15:24:44 2012 +0000
1.3 @@ -66,7 +66,7 @@
1.4 this.name = settings.GetValue(
1.5 new Identifier(Identifier, "name").ToString(), name);
1.6
1.7 - GetSensorValuesFromSettings();
1.8 + GetSensorValuesFromSettings();
1.9
1.10 hardware.Closing += delegate(IHardware h) {
1.11 SetSensorValuesToSettings();
1.12 @@ -88,12 +88,12 @@
1.13 }
1.14
1.15 private void GetSensorValuesFromSettings() {
1.16 - string s = settings.GetValue(
1.17 - new Identifier(Identifier, "values").ToString(), null);
1.18 + string name = new Identifier(Identifier, "values").ToString();
1.19 + string s = settings.GetValue(name, null);
1.20
1.21 - byte[] array = null;
1.22 try {
1.23 - array = Convert.FromBase64String(s);
1.24 + byte[] array = Convert.FromBase64String(s);
1.25 + s = null;
1.26 using (MemoryStream m = new MemoryStream(array))
1.27 using (GZipStream c = new GZipStream(m, CompressionMode.Decompress))
1.28 using (BinaryReader reader = new BinaryReader(c)) {
1.29 @@ -108,6 +108,9 @@
1.30 } catch { }
1.31 if (values.Count > 0)
1.32 AppendValue(float.NaN, DateTime.UtcNow);
1.33 +
1.34 + // remove the value string from the settings to reduce memory usage
1.35 + settings.Remove(name);
1.36 }
1.37
1.38 private void AppendValue(float value, DateTime time) {