Professional OPC
Development Tools

logos

Online Forums

Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.

Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.

Do not use the Contact page for technical issues.

System.OutOfMemoryException while reading OPC UA with COM and Visual Basic 6

More
28 Jun 2023 14:53 #11852 by abiegert
The problem is solved. Before I declared every second a variable with a new EasyUAClient to read or write tags. This caused the OutOfMemoryException. Now I have one public variable for the EasyUAClient.
Thank you.
The following user(s) said Thank You: support

Please Log in or Create an account to join the conversation.

More
30 May 2023 14:42 #11776 by support
Hello.

This can be a memory leak caused by improper COM reference counting - either something on your side (although it's not so easy to make such mistake in VB6), or on our side.

Can you reduce your code to a reproducible scenario that we would be able to run here and diagnose? (connecting to some available OPC UA server - either our public demo server, or some server for which a PC-based demo can be obtained).

Best regards

Please Log in or Create an account to join the conversation.

More
30 May 2023 09:24 #11773 by abiegert
I use version 2022.2 for OPC UA. The program used is Visual Basic 6 (COM). OS Windows 10
The program does cyclical reading (1 sec.) with the function “ReadItemValue”. But as I encountered that tags that change on the server are not reflected with the new values with reading, I added a subscription of tags like below:

MonitoringParameters.samplingInterval = 500
For i = LBound(arrDB102Tags) To UBound(arrDB102Tags)
MonitoredItemArguments(i).EndpointDescriptor.UrlString = OPCMachine
MonitoredItemArguments(i).NodeDescriptor.NodeId.expandedText = arrDB102Tags(i)
Set MonitoredItemArguments(i).MonitoringParameters = MonitoringParameters
MonitoredItemArguments(i).SetState (Format$(i))
Set myMonitoredItemArgumentsArray(i) = MonitoredItemArguments(i)
Next i
handleArray(1) = myEasyUAClient1.SubscribeMultipleMonitoredItems(myMonitoredItemArgumentsArray)


From time to time some values are written with “WriteValue”
All works well, but after about 26 – 28 hours it is beginning to have errors. Mainly it is:
“Eine Ausnahme vom Typ "System.OutOfMemoryException" wurde ausgelöst. (-2147024882)”
Mostly some further readings are ok again, then this error comes again or sometimes other errors:
Mindestens ein Fehler ist aufgetreten. (-2146233088)
Out of memory (7)
Can be some more good readings, but after 30 or 60 seconds the program crashes completely.
I tried to unsubscribe and subscribe again when I get such an error or after 24 hours. But that didn’t help. It is not a problem with the RAM of the computer.

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.045 seconds