Announcement

Collapse
No announcement yet.

CS files memory leak

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    CS files memory leak

    I've come across a few different threads now that have tracked down memory leaks to their .cs scripts. Is anything being done about fixing this problem?

    I too am having the same problems that completely go away when disabling a simple cs script I wrote.

    Homeseer crashes every 1 to 2 days. I see tons of "out of memory" errors show up in the log prior to it crashing. Then i'll get an error report that looks something like this:

    Code:
    11/3/2016 8:51:47 PM
    Not enough storage is available to process this command
    HomeSeer version: 3.0.0.297
    Source: System
    Target: Boolean StartWithShellExecuteEx(System.Diagnostics.ProcessStartInfo)
    Stack trace: 
       at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)
       at System.Diagnostics.Process.Start()
       at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
       at HS3.Form1.btnStartupLog_Click(Object sender, EventArgs e)
       at System.Windows.Forms.Control.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnClick(EventArgs e)
       at System.Windows.Forms.Button.PerformClick()
       at System.Windows.Forms.Form.ProcessDialogKey(Keys keyData)
       at System.Windows.Forms.Control.PreProcessMessage(Message& msg)
       at System.Windows.Forms.Control.PreProcessControlMessageInternal(Control target, Message& msg)
       at System.Windows.Forms.Application.ThreadContext.PreTranslateMessage(MSG& msg)
    
    Please specify what you were doing at the time of this error:
    I don't think this error report has much to do with the problem itself. i think HS3 just craps out because of the memory issues.

    I have 386 gigs of available disk space, and 16 GB ram. This should NOT be happening. The machine itself remains completely stable. No resource issues. I just have to kill HS3 and restart it and everything works again for a day or two.

    The script i'm using looks like this:

    Code:
    // Arg 1 - Device ID with on/off dictating whether to control light or not
    // Arg 2 - Device ID with desired light level
    // Arg 3 - Device ID with natural Lux level
    // Arg 4 - Max Lux level before turning on light
    // Arg 5 - comma sep. list of lights to control
    public void Main(Object[] args) 
    {
    char[] argDelimiterChars = { '|' };
    string[] args_arr = args[0].ToString().Split(argDelimiterChars);
    int shouldControl = hs.DeviceValue(Int32.Parse(args_arr[0]));
    if(shouldControl == 1) 
    {
    int natLuxLevel = hs.DeviceValue(Int32.Parse(args_arr[2]));
    int maxLux = Int32.Parse(args_arr[3]);
    
    
    if(natLuxLevel < maxLux)
    {
    int desiredLightLevel = hs.DeviceValue(Int32.Parse(args_arr[1]));
    int lightId = 0;
    
    char[] lightDelimiterChars = { ',' };
    string[] lights = args_arr[4].ToString().Split(lightDelimiterChars);
    
    foreach (string i in lights)
      {
        lightId = Int32.Parse(i);
        
        HomeSeerAPI.CAPI.CAPIControl cc = hs.CAPIGetSingleControl(lightId, true, "Dim (value)%", false, false);
        cc.ControlValue = desiredLightLevel;
        HomeSeerAPI.CAPI.CAPIControlResponse cr = hs.CAPIControlHandler(cc);
    
      } // end foreach
    
    } // end if natLuxLevel
    
    
    } // end if should control
    }
    To be clear, the threads I read indicated that the same code translated to vb scripts did not cause problems for those people, but as cs scripts, they saw memory leaks.

    Garbage collection or something must not working for cs scripts. Please confirm that someone knows about this and is doing something to fix it. This is a serious problem.

    #2
    Anyone?

    Comment


      #3
      I believe very few people here use c scripts, most use vb. Not sure if anyone has reported the issue to HS using a Bugzilla or an email to support@homeseer.com. You may want to use both of those. I expect it won't be a high priority to them, but that is just my opinion.

      Cheers
      Al
      HS 4.2.8.0: 2134 Devices 1252 Events
      Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

      Comment


        #4
        Good suggestion. I will email them, thanks.

        Comment

        Working...
        X