Adapting the router memory
The main memory is used by TwinCAT/BSD and by TwinCAT (TwinCAT memory). The TwinCAT memory is further divided into the router memory and the PLC memory. The router memory is used for ADS communication and the PLC memory for the actual PLC program including TcConfiguration, mapping and data.
An adjustment of the router memory is only necessary if a large amount of ADS communication takes place and for this reason it becomes necessary to design the size of the router memory accordingly. By default the router memory is set in TwinCAT. The maximum value for the router memory is 1024 MB.
Make sure that the heap memory is larger than the router memory and otherwise increase the heap memory before adjusting the router memory (see: Increase heap memory). This chapter shows how the router memory can also be customized under TwinCAT/BSD.
To do this, the XML file at /usr/local/etc/TwinCAT/3.1/TcRegistry.xml
must be adapted as follows:
Path: HKEY_LOCAL_MASCHINE\SOFTWARE\BECKHOFF\TWINCAT3\SYSTEM
Entry: <Value Name="LockedMemSize" Type="DW">{size in Byte}</Value>
Proceed as follows:
- 1. Stop the TcSystemService with the command
doas service TcSystemService stop
- 2. Enter the
doas ee /usr/local/etc/TwinCAT/3.1/TcRegistry.xml
command in the console. The file TcRegistry.xml is opened. - 3. Adjust the
<Value Name="LockedMemSize" Type="DW">{size in Byte}</Value>
entry in the XML file.
---snipped---
<Key Name="System">
<Value Name="RunAsDevice" Type="DW">1</Value>
<Value Name="RTimeMode" Type="DW">0</Value>
<Value Name="AmsNetId" Type="BIN">0542F70C0101</Value>
<Value Name="LockedMemSize" Type="DW">33554432</Value>
<Value Name="SysStartupState" Type="DW">5</Value>
<Value Name="HeapMemSizeMB" Type="DW">1024</Value>
---snipped---
- 4. In this sample a value of 33554432 bytes = 32 MB is set. For example, change the value to 67108864 bytes to increase the router memory to 64 MB.
- Restart the TcSystemService with the command
doas service
TcSystemService start
.