The other day I upgraded my Mac laptop to Big Sur and suddenly eclipse Memory Analyzer tool (MAT) stopped working with an error message “Failed to create the Java Virtual Machine.”, similar to following error dialog.
Upgrading to the latest MAT (version 1.11.0) did not help. I tried switching between different JDK runtimes. But none of them worked for me. Finally the following terminal based solution worked for me.
### open your favorite terminal and change directory to the Contents/MacOS sub-folder of MAT installation folder.
### now run the executable
Of course, there are additional Benefit of running MAT via command line
- increased visibility to actual error / warning during application startup as well as continued execution. This will give us more clues while troubleshooting a problem
- We can override default JVM behavior by passing additional VM arguments. So for example, if we are analyzing a very big hprof file which requires more JVM memory, we can allocate more memory to MAT by following command
./MemoryAnalyzer -vmargs -Xmx1024m
- We can generate MAT reports in headless mode. This will be useful for profiling applications in an automated fashion. I will be covering this in a separate post later
Leave A Comment