MATLAB MATLAB Memory: How to Fix Memory Issues Easily

AI Thread Summary
The discussion centers on memory issues encountered while using MATLAB for graphical data plotting. The user successfully generates data sets on a 64-bit dual-core system but experiences memory errors when plotting multiple data sets simultaneously. Despite suppressing graphical output and clearing variables, the second manual run of the plotting process significantly slows down the computer, indicating potential memory management problems within MATLAB. The conversation highlights two key points regarding memory management: avoiding plotting too many points at once, even when invisible, and ensuring that large variables are cleared in loops. Additionally, there is a sentiment that MATLAB tends to be a memory-intensive application, with some users preferring Python for its efficiency in handling similar tasks.
Pythagorean
Science Advisor
Messages
4,416
Reaction score
327
I've read the (a?) MATLAB file on memory on their webiste. Basically, their advice deals with data generation, which I'm not having a problem with. I generated the data sets quite easily on my 64-bit dual core, while simultaneously posting on physicsforums and playing muds.

But once I got the graphical part, my computer kept getting swamped and memory errors kept popping up (no I'm not trying to run muds or browsers with it). Basicallly, I load and plot nine sets of data (axes) on each figure, then save it as a no compression tiff.

I do this all with the visibility off, so I'm supressing graphical output. I make sure to clear the variables before I load new ones.

I can do this once manually with no problems, but if I don't quit MATLAB and reopen it, the second manual run takes much longer and bogs my computer down (even after MATLAB has crashed and closed). I got the memory errors initially when I tried to automate the whole data set at once.
 
Physics news on Phys.org
@Pythagorean I know that it has been a long time since you posted the thread, but do you remember how you had solved this problem?
 
I don't for this specific case. But I remember two common gotchyas with memory in matlab.
1) don't try to plot too many points at once. Even if it's invisible.
2) make sure you're clearing big variables if you have a loop

Also, I remember Matlab was just a memory hog anyway. I've used nothing but python for the last couple years.
 
  • Like
Likes Wrichik Basu

Similar threads

Replies
4
Views
1K
Replies
5
Views
2K
Replies
1
Views
1K
Replies
9
Views
3K
Replies
6
Views
2K
Replies
3
Views
3K
Replies
8
Views
2K
Replies
1
Views
10K
Back
Top