MATLAB for macOS (Apple Silicon) crashes when certain screen events occur
10 views (last 30 days)
Show older comments
MathWorks Support Team
on 15 Nov 2023
Edited: MathWorks Support Team
on 22 Aug 2024
I am using MATLAB R2023b for macOS (Apple Silicon) on my Apple Silicon Mac machine. I have installed Amazon Corretto 8 as instructed. Every time I wake my Mac from sleep or reconnect external monitors, MATLAB crashes. This appears to be the same issue as Bug Report 1382373.
How can I resolve this issue? The crash log has this line shown below:
[ 12] 0x00000003279a2d4c /Library/Java/JavaVirtualMachines/amazon-corretto-8.jdk/Contents/Home/jre/lib/libawt_lwawt.dylib+00126284 Java_sun_awt_CGraphicsDevice_nativeGetDisplayMode+00000036
Accepted Answer
MathWorks Support Team
on 20 Aug 2024
Edited: MathWorks Support Team
on 3 Jul 2024
This is due to a known issue with Java. For various UI events, Java tries to make Core Graphics calls on the main thread. However, if the main thread is already updating the same elements, it can cause a deadlock. Consequently, when customers experience "screen events" (such as connecting or disconnecting external monitors, changing screen resolution, or waking up from sleep, as detailed in Bug Report 1382373), MATLAB may hang or crash.
The most reliable workaround would be to try and close or minimize MATLAB before plugging and unplugging monitors and before letting the machine to go sleep.
Some users have also seen success using Amazon Corretto 11. To set up and use Amazon Corretto 11, follow the steps below:
1) Download and install Amazon Java 11 from the following URL:https://docs.aws.amazon.com/corretto/latest/corretto-11-ug/downloads-list.html
2) Execute the following command to identify the location of the installed Java 11:
/usr/libexec/java_home -V
3) Run the following command from a Terminal (not MATLAB). This command will set MATLAB to use the specified Java, even if there is another Java version installed.
./matlab_jenv <path to Java 11 jre>
Note: You may need to navigate to the <matlabroot>/bin directory to execute the command above.
If Amazon Corretto is installed in the default folder, then <path to Java 11 jre> is expected to be /Library/Java/JavaVirtualMachines/amazon-corretto-11.jdk/Contents/Home/jre
0 Comments
More Answers (0)
See Also
Categories
Find more on Introduction to Installation and Licensing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!