Memory pig?? Problem with kron function

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!

 Akzeptierte Antwort

Oleg Komarov
Oleg Komarov am 4 Aug. 2011

1 Stimme

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.

4 Kommentare

Zoe Zhang
Zoe Zhang am 4 Aug. 2011
Thanks. So I have no options but give up running this function on this computer?
Zoe Zhang
Zoe Zhang am 4 Aug. 2011
The java heap space is not the more the better? I was also using 128M then I was suggested by tech support to increase it to the maximum...
Thanks!
Oleg Komarov
Oleg Komarov am 4 Aug. 2011
It depends what you need it for...I use a rule of thumb (sorry not literate here). If I were to get too often java errors in the cmd window I would increase the heap space.
Zoe Zhang
Zoe Zhang am 4 Aug. 2011
I see. Thanks~ :)

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (3)

Daniel Shub
Daniel Shub am 4 Aug. 2011

1 Stimme

Have you tried rebooting? You have 4 GB of RAM, MATLAB is using 331 MB, but can only find 587 MB free.

2 Kommentare

Zoe Zhang
Zoe Zhang am 4 Aug. 2011
No, sadly I know little about that. I know it can be done by running msconfig. Then I don't know which to choose and I am afraid that the computer will be restored back to factory settings. Do you know how? Thanks~~
Oleg Komarov
Oleg Komarov am 4 Aug. 2011
Reduce the Java heap space, I have the standard 128 MB. Also, what system are you running, how many applications do you have at startup?

Melden Sie sich an, um zu kommentieren.

Sean de Wolski
Sean de Wolski am 4 Aug. 2011

1 Stimme

Can't you just open the task manager and look at what's using what? Close the program using the most memory... 300Mb of RAM is small for most of today's computers. You could also look at using Matt J's KronProd class which skips the full expansion.

3 Kommentare

Zoe Zhang
Zoe Zhang am 4 Aug. 2011
I am definitely not a PC export :(
I am actually not running any other programs. But I followed this link
http://www.mathworks.com/support/solutions/en/data/1-4M4ZNT/index.html
and now problem solved! Thanks :)
Sean de Wolski
Sean de Wolski am 4 Aug. 2011
Looking into using KronProd, if you have many of these computations to do, is still probably worth your time.
Zoe Zhang
Zoe Zhang am 4 Aug. 2011
I will for sure, thank you :)

Melden Sie sich an, um zu kommentieren.

Zoe Zhang
Zoe Zhang am 4 Aug. 2011

1 Stimme

I increased the memory allocated to MATLAB R2011a by using the steps at the following link resolves the issue:
>> memory
Maximum possible array: 1023 MB (1.072e+009 bytes) *
Memory available for all arrays: 1637 MB (1.717e+009 bytes) **
Memory used by MATLAB: 306 MB (3.213e+008 bytes)
Physical Memory (RAM): 3774 MB (3.957e+009 bytes)
* Limited by contiguous virtual address space available.
** Limited by virtual address space available.
Now the code runs :) Thanks everyone!

Kategorien

Mehr zu Startup and Shutdown finden Sie in Hilfe-Center und File Exchange

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by