TLC out of memory

From MotoHawk
Jump to navigationJump to search

The TLC out of memory condition is the Computer PC memory used by TLC (Mathworks target language compiler), and not the ECU. This can happen on large builds, and is related to TLC and the PC hardware.

Some recommendations we received from the Mathworks:

1. Always ensure you start MATLAB from c:\Program Files\MATLAB\R20XXy\bin\matlab.exe and not from c:\Program Files\MATLAB\R20XXy\bin\win32\matlab.exe. It is not supported to run *\bin\win32\matlab.exe directly without using the ‘starter’ exe located at *\bin\matlab.exe. The starter exe uses special memory “shield” technology to help prevent Windows from loading system or driver dll's that fragment memory address space.

2. Minimize the amount of data you load into MATLAB workspace to only what is needed/used by the model being code gen’ed.

3. Increase the amount of address space available to processes on 32-bit Windows from 2GB to 3GB, this will give the MATLAB process 3GB. See this tech note: http://www.mathworks.com/support/solutions/en/data/1-4M4ZNT/index.html?solution=1-4M4ZNT

4. You can increase the address space available if you start MATLAB without Java using the command line option (–nojvm). Also, restart MATLAB before each code generation attempt to ensure that memory fragmentation is at a minimum for the MATLAB process (i.e. that the largest available contiguous memory blocks are at a maximum).

5. Explore/experiment with “matlab –shield medium” or “matlab –shield maximum” as these ‘opt-in’ settings allow the starter exe to be more aggressive in preserving contiguous free address space. More information on shielding is located at: http://www.mathworks.com/support/solutions/en/data/1-AS24MF/?solution=1-AS24MF, see items 8, 9.

6. Switch to 64-bit Windows and use 64-bit MATLAB. This will remove the out-of-memory issue since there is 8 TB of address space available to the MATLAB process.

7. Switch to 64-bit Windows and use 32-bit MATLAB. This will give ~4GB of address space to the 32-bit MATLAB process.

8. Other information on memory usage by MATLAB can be found at this tech note: http://www.mathworks.com/support/tech-notes/1100/1107.html

9. Utilize MotoHawk Components or Simulink reference models to break up large models into workable pieces that can be updated and built separately. MotoHawk 2015a is the earliest MotoHawk version that supported the use of Simulink reference models.

In addition, there have been improvements to the way in which MotoHawk handles memory during the build in MotoHawk 2012a and higher. We have found that switching to a 64-bit Matlab and 64-bit build machine resolved this issue.

You may also try splitting the build into two parts by checking the 'Generate Code Only' checkbox in Simulink's Configuration Parameters, then running the build.bat file found in your build folder from the Windows/DOS command line when it is finished.