Main Content

MATLABRuntimeComponent Cache and Deployable Archive Embedding

Deployable archive data is automatically embedded directly in .NET Assemblies by default and extracted to a temporary folder.

Automatic embedding enables usage of theMATLAB®Runtime通过环境杂文集组件缓存特性bles.

These variables allow you to specify the following:

  • Define the default location where you want the deployable archive to be automatically extracted

  • Add diagnostic error printing options that can be used when automatically extracting the deployable archive, for troubleshooting purposes

  • Tuning theMATLAB Runtimecomponent cache size for performance reasons.

Use the following environment variables to change these settings.

Environment Variable Purpose Notes
MCR_CACHE_ROOT When set to the location of where you want the deployable archive to be extracted, this variable overrides the default per-user component cache location. This is true for embedded.ctffiles only. OnmacOS, this variable is ignored in MATLAB R2020a and later. The app bundle contains the files necessary for runtime.
MCR_CACHE_SIZE When set, this variable overrides the default component cache size. The initial limit for this variable is 32M (megabytes). This may, however, be changed after you have set the variable the first time. Edit the file.max_size, which resides in the file designated by running themcrcachedircommand, with the desired cache size limit.

Note

If you runmccspecifying conflicting wrapper and target types, the archive will not be embedded into the generated component. For example, if you run:

mcc -W lib:myLib -T link:exe test.m test.c

the generatedtest.exewill not have the archive embedded in it, as if you had specified a-Coption to the command line.

Caution

Do not extract the files within the.ctffile and place them individually under version control. Since the.ctffile contains interdependent MATLAB functions and data, the files within it must be accessed only by accessing the.ctffile. For best results, place the entire.ctffile under version control.