MATLAB: Memory pig?? Problem with kron function

kronMATLABmemoryout of memory

W = kron(inv_covariance,I);
??? Out of memory. Type HELP MEMORY for your options.
Error in ==> kron at 34
K = A(ia,ja).*B(ib,jb);
inv_covariance = 11*11 double, I = ones(598,598)
I ran this code on Tuesday, totally worked. But since yesterday, failed to run.
>> memory
Maximum possible array: 200 MB (2.095e+008 bytes) *
Memory available for all arrays: 587 MB (6.157e+008 bytes) **
Memory used by MATLAB: 331 MB (3.468e+008 bytes)
Physical Memory (RAM): 3774 MB (3.957e+009 bytes)
  • Limited by contiguous virtual address space available. Limited by virtual address space available.
I think there is enough space (Java heap space 943 MB) and tech support helped me to run this code on other computers that have the same operation system as mine and the code worked.
Does this occur to anyone before? Any suggestions? Thanks in advance!

Best Answer

Your W will be around 300 MB and yes it is a common problem.
Any solution is not infinitely scalable in practice due to constraints:
  • memory (RAM).
  • time.
Related Question