Slow Java initialization during startup

17 views (last 30 days)
I have Matlab R2023a installed on an up-to-date Arch Linux system. Installation didn't have any issues but it takes several minutes for Matlab to start. The splash screen appears right away but then it is stuck there for several minutes before the main interface appears.
Staring with the -timing flag points to PostVMInit and InitDesktop, whatever those are.
MATLAB Startup Performance Metrics (In Seconds)
total item gap description
=========================================================
0.18 0.18 0.00 MATLAB script
0.25 0.07 -0.00 main
0.27 0.02 0.00 Session Initialize
0.74 0.00 0.47 Toolbox cache load Start
0.74 0.18 0.29 Session Initialize
0.90 0.04 0.87 LM Startup
0.92 0.18 0.74 cachepath
0.93 0.02 0.00 splash
1.13 0.12 0.08 Constant Initialization
1.15 0.23 0.00 Engine Startup
1.22 0.07 0.00 InitSunVM
242.13 240.89 0.03 PostVMInit
242.13 240.98 0.00 mljInit
242.39 0.26 0.00 StartDesktop
242.39 241.24 0.00 Java initialization
242.39 0.00 0.00 psParser
242.42 0.00 0.03 Toolbox cache join
242.68 0.17 0.08 matlabpath
242.88 0.05 0.16 matlabrc
363.68 121.29 242.39 Init Desktop
363.74 121.35 242.39 Ready
=========================================================
Items shown account for 100.0% of total startup time
Running bare with matlab -nojvm starts quickly.
< M A T L A B (R) >
Copyright 1984-2023 The MathWorks, Inc.
R2023a Update 1 (9.14.0.2239454) 64-bit (glnxa64)
March 30, 2023
Warning: X does not support locale en_US.UTF-8
For online documentation, see https://www.mathworks.com/support
For product information, visit www.mathworks.com.
>> MATLAB Startup Performance Metrics (In Seconds)
total item gap description
=========================================================
0.20 0.20 0.00 MATLAB script
0.26 0.07 0.00 main
0.28 0.01 0.00 Session Initialize
0.69 0.00 0.41 Toolbox cache load Start
0.69 0.14 0.27 Session Initialize
0.85 0.04 0.81 LM Startup
0.85 0.00 0.00 splash
0.85 0.16 0.69 cachepath
1.02 0.10 0.08 Constant Initialization
1.04 0.20 0.00 Engine Startup
1.04 0.00 0.00 Java initialization
1.05 0.00 0.00 psParser
1.07 0.00 0.02 Toolbox cache join
1.26 0.15 0.04 matlabpath
1.41 0.03 0.12 matlabrc
=========================================================
Items shown account for 70.6% of total startup time

Accepted Answer

Vinayak
Vinayak on 22 May 2023
A few methods that could be implemented to curb this would be
  1. Increasing Java Memory heap space, You can increase the Java heap space by editing the "javaclasspath.txt" file in the MATLAB preferences directory. This file is used to configure the Java classpath and other Java related settings. You can add the following line to set the Java heap size:
-Xmx2048M
  1. Holy Trinity, Holy trinity refers to a series of steps taken to rehash the toolbox and matlab paths
rehash
rehash toolbox
rehash toolboxcache
  3 Comments
Vinayak
Vinayak on 23 May 2023
Hi Tyler,
  1. You could try removing some toolboxes or addons you dont use frequently via the add on manager and check to see if it improves the startup time.
  2. There is a possibility that you have some custom startup files in 'startup.m'. You can try to run matlab without these to see if it improves startup time. This can be done by using -nosplash -nojvm -nodesktop -nodisplay' flags in the command line while starting MATLAB.
  3. Increasing the JVM Memory, I had already mentioned this in the last comment and you had also ascertained that you ran the command that I provided. Just to be sure you could go to the "Advanced" tab in the "Preferences" dialog box and click on "Java Heap Memory". and confirm the "Initial Heap Size" and "Maximum Heap Size" fields.
  4. If nothing works, maybe upgrading to the latest version or a last resort could be to reinstall MATLAB.
Thanks,
Vinayak
Tyler
Tyler on 24 May 2023
Is the end, I did a reinstall and now it is starting normal. Thank you.

Sign in to comment.

More Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!