Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MATLAB slowing down on long debugging sessions

Tags:

matlab

I have noticed that MATLAB (R2011b on Windows 7, 64 bit) tends to slow down if I am in debugging mode for a long period of time (e.g. 3 hours). I don't recall this happening on previous versions of MATLAB.

The slow down is small, but significant enough to have an impact on my productivity (sometimes MATLAB needs to wait for up to 1 sec before I can type on the command line or on the editor).

I usually spend hours on debugging mode (e.g. after stopping at a keyboard statement) coding full projects in this mode. I find working on debugging mode convenient to organically grow my code while inspecting my code anytime in execution time.

The odd thing is my machine has 16 GB of RAM and the total size of all workspaces while in debugging mode is usually less than 4 GB. I don't have any other large process running in the background, and my system reports ~8GB of free RAM.

Also, unfortunately MATLAB does not let me call pack from debugging mode; it complains with :

Warning: PACK can only be used from the MATLAB command line. 

I have reproduced this behavior after restarting MATLAB, rebooting my system, and on different days. With this, my question/s are:

  • Has anybody else noticed this? Is there anything I could do to prevent this slowdown without exiting debugging mode?
  • Are there any technical notes or statements from Mathworks addressing this issue?

In case it matters, my code is on a network drive, so I added the following on my startup.m file, which should alleviate any impact on performance resulting from it:

system_dependent('RemoteCWDPolicy', 'None');
system_dependent('RemotePathPolicy', 'None');
system_dependent('DirChangeHandleWarn','Never');
like image 587
Amelio Vazquez-Reina Avatar asked Oct 12 '11 15:10

Amelio Vazquez-Reina


1 Answers

I have experienced some similar issues. The problem ended up being that Mathworks changed how Matlab caches files. For some users, it is now storing data in the TMP folder as defined by the environment variables. This folder was being scanned by anti virus and causing a lot of performance problem. Of course, IT wouldn't let us exclude the TMP folder from scans. So we added a line to our start up script that changes the environment variable of TMP to some other location within an excluded folder.

You don't have to worry about changing the variable back or messing up other programs. When applications launch, they copy the environment variables into their own local instance of them. Any changes made to them only change the local copy of those variables, not the system copy.

Here is the function you will need.

setenv('TEMP', 'C:\TEMP');

I'm not sure if it was TMP or TEMP. Check your environment variables to be sure.

like image 157
Miebster Avatar answered Oct 21 '22 23:10

Miebster