From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

memory leak??

My application(mesurement studio 7.0 vb.net2003) get data over several datasockets(opc) from fieldpoint  every seconds.
 
whenever i get the data, Using memory increased several KBs.
After running the applicaton for a day, it goes up 80Mega bytes...
any solutions??
 
thanks for reply in advance..
 
0 Kudos
Message 1 of 4
(3,039 Views)
are you adding the datasocket data to an array or dataqueue ?
Philip Newman
General Dynamics
Electric Boat
0 Kudos
Message 2 of 4
(3,024 Views)
yes i did..
i made my class that creates several datasoket instances in code
and  assigned datasocket data  to a array..
 
Private cData() As Int16
Private nData() As Int16     
Private Const channelPerIO = 16
Public DigitalIOCount As Integer
Private DataSocket() As NationalInstruments.Net.DataSocket
 
  Public Function GetData() As String
        Dim i, j As Integer
        Dim temp As Int16
        Dim ret As String
        For i = 0 To DigitalIOCount - 1
            Try
                DataSocket(i).Update()
                nData(i) = CType(DataSocket(i).Data.Value.ToString, Int16)
                temp = (cData(i) Xor nData(i))
                For j = 0 To channelPerIO - 1
                    If (temp And (2 ^ j)) Then
                        lvCount.Items(i * channelPerIO + j).SubItems(1).Text = IIf((nData(i) And (2 ^ j)), "True", "False")
                        lvCount.Items(i * channelPerIO + j).StateImageIndex = IIf((nData(i) And (2 ^ j)), 1, 0)
                        lvCount.Items(i * channelPerIO + j).SubItems(2).Text = CType(lvCount.Items(i * channelPerIO + j).SubItems(2).Text, Integer) + 1
                      End If
                Next
                cData(i) = nData(i)
            Catch ex As Exception
                ret += "channel" + i.ToString
            End Try
        Next
...
End Function
 
0 Kudos
Message 3 of 4
(3,020 Views)
Thanks for your reply..
 
That was Thread problem...
 
0 Kudos
Message 4 of 4
(3,015 Views)