Why do I receive an "Unable to start the JVM" error when trying to use my MATLAB Builder EX Add-in or MATLAB Builder NE COM Object in Excel?

8 views (last 30 days)
Upon creating an object instance of my MATLAB Builder EX Add-in or MATLAB Builder NE Object in VBA in Excel I receive the following error:
Unable to start the JVM.
Error occurred during initialization of VM
Could not reserve enough space for object heap
After clicking OK Excel may exit.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 18 Oct 2013
When you are working with a MATLAB Builder EX or NE component in Excel, the MATLAB Compiler Runtime (MCR) must be loaded into the memory space of Excel. This memory space is also shared with (other) Excel Add-ins. If these other Add-ins are using too much memory already or if they have fragmented the Excel memory too much, the MCR will not be able to fully load and display the error given above.
First of all please double check your "Java Heap Memory" settings under "General" in the "Preferences" of the MATLAB installation used to compile the component. If this is set to anything other than the minimum value, try setting it to the minimum value. Then verify that your code still runs in MATLAB. If so recompile the component and try using this new component in Excel again. If this does not resolve the issue try one of the other options below.
Alternatively, try disabling other Add-ins in Excel. When doing so please make sure to check both the "Excel Add-ins" and the "COM Add-ins". So you basically need to go to "Excel Options" and then "Add-ins" twice. Where the first time you select "Excel Add-ins" and the second time choose "COM Add-ins" from the dropdown:
Another solution could be to try to disable the JVM (see the "Advanced" tab of your DEPLOYTOOL project settings). Note this will only work if your code does not depend on any Java functionality in MATLAB; to verify this you can try running your code in a MATLAB session started with the -nojvm option.
Lastly if you are on Windows XP and are using MATLAB Builder EX (R2012b), you can try deleting the file named nativewebproxy.dll from your MATLAB/MCR bin\win32 directory. Removing this DLL will not hinder any MATLAB functionality but will may reduce memory fragmentation.

More Answers (0)

Categories

Find more on Data Export to MATLAB in Help Center and File Exchange

Tags

No tags entered yet.

Products


Release

R2012a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!