CPU and memory creep
Modbus TCP, Modbus UDP and Modbus RTU client/server Java library
Brought to you by:
sr555
I noticed while running the server that the CPU usage and memory usage creeps up with every new client that connects, performs any functions, then disconnects. I've also tried setting up a dummy server that is set up to only listen. The same thing happens when firing messages from the client library to the dummy server. I am also calling the Disconnect() method on the client in the finally block. The same problem occurs when receiving messages from PLCs. I've tried calling modbusServer.setNumberOfConnectedClients(modbusServer.getNumberOfConnectedClients() - 1) in logDataChangedEvent as well. The problem persists.
Looking in the debugger I see that it's creating a new ClientConnectionThread for every time a client connects. Why is it holding onto them even after I call Disconnect() in the client?