Increase heap memory
Notice | |
Oversized heap memory If the heap memory is too large, the entire main memory is allocated, which leads to the system not working properly. Make sure that the heap memory is not selected too large in relation to the available main memory. |
If the heap memory is too small for the download of a PLC project, a corresponding error is issued and the process is aborted.
When activating the TwinCAT project where the PLC project is in AutoStart, TwinCAT simply switches back to Config mode and there is no error message or similar.
The size of the heap memory is not automatically adjusted, but can be increased under TwinCAT/BSD for extensive PLC projects in the file /usr/local/etc/TwinCAT/3.1/TcRegistry.xml
. To do this, the XML file must be expanded as follows:
Path: HKEY_LOCAL_MASCHINE\SOFTWARE\BECKHOFF\TWINCAT3\SYSTEM
Entry: <Value Name="HeapMemSizeMB" Type="DW">{size in MB}</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. Add the
<Value Name="HeapMemSizeMB" Type="DW">{size in MB}</Value>
entry to the XML file at<Key Name="System">
.
---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. The size is set in megabytes. In this sample, these are 1024 MB.
- Restart the TcSystemService with the command
doas service
TcSystemService start
. After the heap memory is increased to 1024 MB, the PLC project starts and the download is not aborted with an error.