- Your antivirus is running wild ( link1, link2, link3 )
- You are using a CVS (code-versioning system) that is ill-configured
- You use a remote Matlab license server that is unreachable, or you experience license manager lockouts for some reason, or you're using a mis-configured license file or LM_LICENSE_FILE environment variable
- You have clashes with other software that uses the same FLEXnet license manager as Matlab ( link1, link2 )
- You have mapped drives that are disconnected for some reason but Matlab doesn't know this
- You have a very long Matlab path
- You have defined a function somewhere on the Matlab path that has a name which overrides some internal Matlab function
- Your Matlab installation is critically fragmented on disk (=> run a defragmetation utility)
- You are using a toolbox that is ill-configured (e.g., symbolic toolbox)
- You are running Matlab via an X-server or SSH
- You have disabled toolbox caching in the global Matlab preferences
- You have defined numerous workspace variables
- You have numerous files loaded in the Editor
- You have multiple open figure windows
- You are using SELinux without setting the allow_execheap flag (so JIT is disabled)
- You are using a vast number of Windows fonts
- You are using unnecessary web-proxy auto-discovery
- You have insufficient physical RAM to run Matlab, thereby causing extensive disk thrashing
After Allocating a Large Variable and Crashing, MATLAB is Forever Slow
32 views (last 30 days)
I was playing around with variable allocation sizes to see how it effected my RAM allocation. Another words, looking at a third party memory stats program I would allocate a vector with 1 billion entries and see how much RAM that required.
When I got to allocating 4 billion entries, my entire computer froze. I didn't have a problem with this, I was expecting it to happen at some point. After restarting however, MATLAB seems to be permanently broken. It gets stuck in the busy state upon startup for at least a minute every time. When I try to save a new script, I get weird behavior like the file never being saved even though MATLAB makes me believe it has been. I have tried deleting the AppData\Roaming\Mathwords\R2012b folder but it has no effect. Are there other folders or files like this that I can try removing?
I would like to know the cause of this, but above all I would like to know how to fix this. There must be a way to get MATLAB fixed without having to re-install. Can anyone help?
Yair Altman on 1 Jan 2014
Edited: Yair Altman on 1 Jan 2014
Several possibilities spring to mind:
To isolate things, start Matlab with no startup.m file and with only the default MathWorks path (i.e., remove your folders from the path). If it's now ok, then start adding user paths until you find the culprit. If it's not ok, try reinstalling Matlab from scratch.
Walter Roberson on 31 Dec 2013
I would start by deleting matlab.prf out of prefdir . See http://www.mathworks.com/help/matlab/matlab_env/preferences.html#bsoa5yg-1 before starting MATLAB. Then start it, and when you get a prompt, command
rehash toolboxreset; rehash toolboxcache
Another thing I would check would be whether the slowdown is in a network connection at MATLAB startup time. That might be for license checking purposes; there is also something unknown that can require a network connection at startup time in some versions (some kind of authentication ?).
If you are having network problems, one thing to try is to open up your firewall for a moment and see if MATLAB starts faster (remember to close it afterwards.) But oddly the other network issue is most easily diagnosed by turning your network off before starting MATLAB and seeing if it starts quickly. I do not recall what the cause of that second kind of problem was, but I seem to recall that adding an entry for
to your hosts file can help; see http://www.mathworks.com/matlabcentral/newsreader/view_thread/88539 for a mention of where the hosts file lives in MS Windows
Yaroslav on 20 Aug 2017
I have had the same problem in my R2017a (!) version. I have been inspecting the memory usage and running time of some function, which creates a large array based on an input size parameter. Alas, for a very large size – instead of throwing out-of-memory error – my computer stuck, so I had to forcefully abort and exit Matlab. Moreover, I had to restart the computer, as everything became too slow.
When I returned to Matlab, I have noticed a strange phenomenon: to my horror, everything became 3 times slower than before. Nothing helped:
- Restarting the computer;
- Restarting Matlab;
- Rehashing toolboxes;
- Removing prefdir;
- Running disk defragmentation;
- Running cleanup programs;
- Even reinstalling Matlab (!) did not help.
Before I continue, I need to emphasize an important point. I have noticed this hindrance in Matlab's speed only because I was probing the run-time to begin with. Impedance of a factor of 3 is not substantial enough to notice in naked eye. Yet, it is a very significant change rendering most of the simulations useless. It could have been weeks before I had noticed something was wrong, and by then it would have been too late, as there would be nothing to compare to. @Sean de Wolski, I believe it is a crucial bug in Matlab that must be addressed.
Finally, what has worked is the following.
- Draining the battery of my laptop (Dell Vostro).
- Running Dell System Diagnostic Tool at the boot-level. I ran it twice, just in case, with all the options on (with emphasis on memory and cores).
- Rebooting the computer.
Matlab is now back to its fast self. Yet, I have no idea why it has succeeded. This behavior should not exist in a ubiquitous program such as Matlab.
Sean de Wolski on 31 Dec 2013
I would recommend first just upping your Java Heap Space. This is the first thing to do for desktop sluggishness.
Home Tab - Preferences - MATLAB - General - Java Heap Memory.
Bump this up, apply and restart MATLAB.
Also, make sure you do not have any network directories on your path and that you are not trying to navigate to one in startup.m