Products & Services Solutions Academia Support User Community Company

Learn more about MATLAB Compiler   

Reserving Memory for Deployed Applications with MATLAB Memory Shielding

What Is MATLAB Memory Shielding and When Should You Use It?

Occasionally you encounter problems ensuring that you have the memory needed to run deployed applications. These problems often occur when:

Use MATLAB Memory Shielding to ensure that you obtain the maximum amount of contiguous memory to run your deployed application successfully.

MATLAB Memory Shielding provides the specified level of protection of the address space used by MATLAB. When you use this feature, it reserves the largest contiguous block of memory available for your application after startup.

Memory shielding works by ensuring that resources, such as DLLs, load into locations that will not fragment the address space of the system. The feature provides the specified amount of contiguous address space you specify, up to the maximum available on the system.

For example, on a 32-bit Windows system, MATLAB defaults to memory shielding for virtual addresses 0x50000000-0x70000000. At the point where your application runs, the shield lowers, allowing allocation of that virtual address space.

Requirements for Using MATLAB Memory Shielding

Before using MATLAB Memory Shielding for your deployed applications, verify that you meet the following requirements:

Invoking MATLAB Memory Shielding for Your Deployed Application

Invoke memory shielding by using either the command-line syntax or the GUI. Each approach has appropriate uses based on your specific memory reservation needs.

Using the Command Line

Use the command line if you want to invoke memory shielding only with the various shield_level values (not specific address ranges).

The base command-line syntax is:

MemShieldStarter [-help] [-gui] [-shield shield_level] fully-qualified_application_path [user-defined_application_arguments]
  1. Run your application using the default level of memory shielding. Use the command:

    MemShieldStarter fully-qualified_application_path [user-defined_application_arguments]
  2. If your application runs successfully, try the next highest shield level to guarantee more contiguous memory, if needed.

    • A higher level of protection does not always provide a larger size block and can occasionally cause start-up problems. Therefore, start with a lower level of protection and be conservative when raising the level of protection.

    • Use only memory shielding levels that guarantee a successful execution of your application. See the table MemShieldStarter Options for more details on which shield options to choose.

    • Contact your system administrator for further advice on successfully running your application.

  3. If your application fails to start, disable memory shielding:

    1. To disable memory shielding after you have enabled it, run the following command:

      MemShieldStarter -shield none fully-qualified_application_path [user-defined_application_arguments]
    2. Contact your system administrator for further advice on successfully running your application.

MemShieldStarter Options

OptionDescription
-helpInvokes help for MemShieldStarter
-guiStarts the Windows graphical interface for MemShieldStarter.exe. See Using the GUI for more details.
-shieldshield_levelSee Shield Level Options.
fully-qualified_application_pathThe fully qualified path to your user application
user-defined_application_argumentsArguments passed to your user application. MemShieldStarter.exe only passes user arguments. It does not alter them.

Shield Level Options.   shield_level options are as follows:

Using the GUI

Use the graphical interface to invoke memory shielding for specific address ranges as well as with specific shield_level values.

  1. To start the GUI, run the following at the system command prompt:

    MemShieldStarter.exe -gui

    The Memory Shielding Starter dialog box opens:

  2. Enter the appropriate values as described in MemShieldStarter Options. Use the default Memory shielding level minimum.

    You can specify a specific address range in the Memory address range fields. Specifying a range override the default 0x50000000 through 0x70000000 address range values required for the shield_level minimum, for example.

  3. Click Run.

  4. If your application runs successfully, try the next highest shield level to guarantee more contiguous memory, if needed.

    • A higher level of protection does not always provide a larger size block and can occasionally cause startup problems. Therefore, start with a lower level of protection and use only what is necessary to guarantee a successful execution of your application.

    • See the table MemShieldStarter Options for more details on appropriate shield options for various situations.

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS