Modbus TCP locks up Uno

I have an UNO with the SunFounder Ethernet Shield W5100 and using the ArduinoModBus library. The problem I am having is the UNO locks up when the code runs modbusTCPServer.accept(client);.

Any Ideas why this is happening?

Attached is the code.

Modbust_Test_2.ino (2.32 KB)

the library uses dynamic memory allocation and fragments the small SRAM of the Uno fast to unusable state.

here I have two functions for a simple ModbusTCP

see the rest of that sketch as examples

Thanks for the Code, I will spend some time and dissect it at a later date. Currently I have the code working by downgrading the Arduino IDE to 1.6.13.