Hi, I have a problem with computer resources when I run my vb6 exe (QuickOpc 2019.2).
My program starts the OpenConnection function every 15 seconds for testing the status of the machine,
but after few hours the process keeps a lot of resources in Windows TaskManager like 1 GB or more.
I already tried to close every connection and set object to "nothing" but the problem remains.
It's like something does not clear the memory or the connection still open.
Could you help me?
Thank you
Private Function OpenConnection()
Dim Client As New EasyUAClient
OutputText = ""
Dim ReadArguments1 As New UAReadArguments
ReadArguments1.EndpointDescriptor.UrlString = "Server"
ReadArguments1.EndpointDescriptor.UserIdentity.UserNameTokenInfo.UserName = "User"
ReadArguments1.EndpointDescriptor.UserIdentity.UserNameTokenInfo.Password = "Password"
ReadArguments1.NodeDescriptor.NodeId.expandedText = "ns=2;s=Channel_1-ExecutionState"
Dim arguments(0) As Variant
Set arguments(0) = ReadArguments1
' Obtain values. By default, the Value attributes of the nodes will be read.
Dim results() As Variant
results = Client.ReadMultipleValues(arguments)
' Display results
Dim i: For i = LBound(results) To UBound(results)
Dim Result As ValueResult: Set Result = results(i)
If Result.Succeeded Then
If Val(Result.Value) = 0 Then Status = "Off"
If Val(Result.Value) = 1 Then Status = "On"
If Val(Result.Value) = 2 Then Status = "interrupt"
If Val(Result.Value) = 3 Then Status = "listen"
OutputText = "Status: " & Status
Else
OutputText = "*** Failure: Err.n." & Result.ErrorCode & " " & Result.ErrorMessageBrief & vbCrLf
End If
Next
Client.UnsubscribeAllMonitoredItems
Set Client = Nothing
Set ReadArguments1 = Nothing
Set Result = Nothing
Erase results
Erase arguments
End Function