Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Increase Array Block and Resolve Out of Memory Error in Matlab 2009b?

I am using Matlab 2009b and having an out of memory error. I read other posted sol but they are not useful for me. I am sure that i am doing things right but i must use very huge amount of array sizes. I think that the problem lies beyond the fact that Matlab does not enable an array to be in more than one OS block. I am using Windows 7. Is there a way to get rid of this problem? For example, can I increase the array block that Matlab uses in Windows 7?

System: Windows 7
Matlab: 2009b

like image 535
Hani Avatar asked Feb 27 '23 02:02

Hani


2 Answers

If you think your array sizes are not big enough to warrant such an error, maybe your previous operations fragmented available memory. MATLAB requires contiguous blocks so fragmentation can lead to such errors.

So before the point in your code where an out of memory error occurs, try running the pack command. That's all I can think of apart from the usual fixes.

like image 101
Jacob Avatar answered Mar 02 '23 12:03

Jacob


If the largest available block (as shown by memory) is much smaller than the maximum amount of memory available to Matlab, a restart of Matlab (or the system) can help.

Otherwise, you need to either rewrite your code or buy more RAM (and/or use the 64-bit version of Win7).

I suggest you try rewriting your code. It is very often possible to work around memory issues.

EDIT

From your comment on @Richie Cotton's post, I see that you want to do classification an a huge amount of data. If the are a small number of classes, none of which are very sparse, you can solve the problem by running kmeans on, say, 10 randomly chosen subsets of, say, 30% of your data each. This should find you the centers of the clusters just fine. To associate your data with the kernels, all you have to do is calculate, for each data point, the distance to the cluster centers and associate them with the closest center.

like image 34
Jonas Avatar answered Mar 02 '23 13:03

Jonas