The only way to work around this limitation is to restructure your application to use a smaller amount of persistant variable.
Question
Why do I receive an error when protecting a model reference block that contains an Embedded MATLAB block in its design in Simulink 7.6 (R2010b)? I am trying to create a protected model reference block using the following steps: Simulink.ModelReference.protect('model_name') %model_name is the name of the model After this step, Real-Time Workshop build procedure for model is aborted due to a CGIR assertion. I receive the following error message: CGIR assertion in b:\matlab\src\cg_ir\util_prim/Size64.hpp(93): 'fSize == (Uint64)i' ### Real-Time Workshop build procedure for model: 'PrimeMover4' aborted due to an error. ??? Error using ==> tlc_c at 160 Unexpected or internal error encountered in "in CGIR: b:\matlab\src\cg_ir\util_prim/Size64.hpp line 93: fSize == (Uint64)i ". Please report this to The MathWorks if you can cause it to recur.
Expert Answer
Kshitij Singh
PhD Expert
Answered Aug 14, 2026
The issue is due to a compiler limitation related to the maximum size of a persistent, input or output variable that can be declared in an Embedded MATLAB Function block or MATLAB code. In Simulink 7.5 (R2010b), the compilation process returns a CGIR error.
In the latest release of Simulink 7.7 (R2011a), the build process return the error from the compiler:
LINK : fatal error LNK1248: image size (8F11E000) exceeds maximum allowable size (80000000)
From the above error message it is inferred from the Microsoft Viual Studio documentation that it is not possible to have more than a total of 80MB of persistent variable assignment.
For example an assignment of type:
persistent p;
if(~isempty(p))
{
p = 0;
}
p = single(zeros(1,200000000));
100% Run Guarantee
3-Hour Fast-Track Delivery
Need a Custom Version or Complete Simulation for This Problem?
Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.
Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here
Related Code Generation Questions & Solutions
Browse All →
Explore similar technical troubleshooting questions and verified MATLAB solutions:
Ready-to-Run MATLAB & Simulink Projects
Browse All Projects →