• Welcome to Forum.Deepsoftware.Com. Please login or sign up.
 
December 03, 2024, 01:53:08 pm

News:

SMF - Just Installed!


Modbus packets leaking memory

Started by peer, October 15, 2020, 01:54:45 pm

Previous topic - Next topic

peer

Latest v9.56 and v9.57 is leaking memory with Modbus packets. See image. I have a application which communicates constantly with several Modbus slaves, after time the application hangs with a system error: reOutOfMemory. It seems that Modbus packets are added to a collection with a size of 16384, it runs out of memory. Downgraded to v9.53 and eveything is working okay !

peer

Uploading image (73kB) didn't work...

Roman Novgorodov

Hello

Thank you for information.

Can you provide some more details:
What requests do you use?
Howe many registers are read?
How long time gone before exception appears?

We will try to run ModbusDemo for long time and check with our modbus devices.

Roman Novrogodov
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

peer

October 17, 2020, 04:46:44 am #3 Last Edit: October 17, 2020, 04:48:36 am by peer
We use ReadRegisters, ReadInputRegisters and WriteRegisters. In total 31 registers are used for reading and writing. We have internal list of slave addresses and registers, they are processed in a thread one by one (no polling). We take the address and register out of internal list and do ReadRegisters, ReadInputRegisters or WriteRegisters according which address and register it concern. OnModbusReply is used for further processing, if that's done then the next item in our internal list will be processed. This will run in a loop 24/7. Also we use OnTimeout, if that happen then we wait 160ms for we resend again. If we still get Timeout after sending it 3 times we will pause all items with the same address for 90 sec. Maybe the slave is offline, cable is disconnected or device crashed. In this way We can keep communicate with the other devices even if some devices are "bad".
We run into problems after 5..20 minutes, Timeouts speed up the problems. So maybe the timeout processing is not working correctly ?

As said: v9.53 don't have this problem.

Roman Novgorodov

Hello

Thank you for call stack and for info.

You are right.
There is memory leak after every new .ReadXxxx() method.
We fixed bug and will test more and will release new version in the next 48 hours.

Roman Novgorodov

DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

Roman Novgorodov

Hello

Please check v9.58

Roman Novgorodov
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

peer