AnsweredAssumed Answered

Memory Leak using Event Pipes

Question asked by Steve Boyko Champion on Jun 25, 2015
Latest reply on Jun 29, 2015 by Steve Boyko

I have a PI-SDK application I wrote in C# that is leaking memory. I've traced it down to the PI portion and I can't understand why it is leaking. I've simplified it to this loop of code:

 

public static void PIDataEventHandler()

{

   try

   {

      for (int i = 0; i < lstPoints.Count; i++)

      {

         if (lstPoints[i].datapipe.Count > 0)

         {

            Array events = lstPoints[i].datapipe.TakeAll();

         }

      }

   }

   catch (Exception e)

   {

      ReportMessage("Error " + e.Message + " handling PI data event(s)" , ReportingLevels.Warning);

   }

}

 

lstPoints is an array containing tag definitions and the reference to the event pipe already set up. PIDataEventHandler is the routine that receives new events from PI-SDK. In this sample code I am just throwing the events away but normally I process them... I just wanted to get the simplest code that still has the memory leak.

 

Does anyone have any suggestions?

Outcomes