Menu

free memory -c# ?

alex c
2009-08-31
2013-05-09
  • alex c

    alex c - 2009-08-31

    I've been tested the follow- in libnodave.net , TCP connection and C# :
    void Timer1Tick(object sender, EventArgs e)
    {
    //READ 1
    p=dc.prepareReadRequest();
    p.addVarToReadRequest(libnodave.daveFlags, 0, 0,(4*55));
    dc.execReadRequest(p,rsR);
    dc.useResult(rsR,0);
    for (int i = 0; i < 55; i++)
        valoresF[i]=dc.getFloat();
    //READ 2
    p=dc.prepareReadRequest();
    p.addVarToReadRequest(libnodave.daveFlags, 0, 220,(4*55));
    dc.execReadRequest(p,rsR);
    dc.useResult(rsR,0);
    for (int i = 0; i < 55; i++)
        valoresF[i]=dc.getFloat();
    }
    timer interval =100ms
    this code , doens't free memory, only up... in 50 minutes,the memory used- from 8.5K to 25.2K and continuos
    I tried , for example, p=null, and nothing....
    how I can resolve this problem ? (my program have only this code)

    thanks,

    Alex...

     
    • Emil Bornus

      Emil Bornus - 2009-09-10

      Hi Alex,
      I' trying to established connection via TCP with s7, but Ive got the same problem with library libnodave - it couldn't properly linked and I don't know why...
      Could you send me simple projetct with linked libnodave ?

      e-mail : emil.bornus@gmail.com

      thanks

       
    • alex c

      alex c - 2009-09-10

      Hi,
      There is an example (.net) , "simpleISO_TCP" in libnodave...
      static libnodave.daveOSserialType fds;
      static libnodave.daveInterface di;
      static libnodave.daveConnection dc;
      static int rack=0; //NORMAL IS 0
      static int slot=2; //THIS POSITION OF CPU (NOT CP)
      string IP=”192.169.1.1”; //example, check your IP of CP(CPU)
      fds.rfd=libnodave.openSocket(102,IP);
      fds.wfd=fds.rfd;
      if (fds.rfd>0)
      {
      di =new libnodave.daveInterface(fds, "IF1", 0, libnodave.daveProtoISOTCP, libnodave.daveSpeed187k);
      di.setTimeout(1000000);
      dc = new libnodave.daveConnection(di,0 , rack, slot);
      if (0==dc.connectPLC()) //here command connect
      {
      res=dc.readBytes(libnodave.daveFlags, 0, 0, 16, null);
      if (res==0) //conection OK,
         //do ...
      }
      }

      Important check:
      -    cables (try PING)
      -    firewall (windows or antivirus)

      good luck

      alxeng2002

       

Log in to post a comment.