Borrar filtros
Borrar filtros

why I get "out of memory" error when i use zeros(60000)?

4 visualizaciones (últimos 30 días)
nadia
nadia el 16 de Nov. de 2015
Comentada: Guillaume el 16 de Nov. de 2015
Hi. when I use zeros(60000) I receive out of memory error.My matlab product is MATLAB R2014a 64 bit. can you help me please?

Respuestas (2)

Thorsten
Thorsten el 16 de Nov. de 2015
You tried to allocate 60000*60000*8 = 28.8 GByte. That's seems to be too much for Matlab on your machine.
  3 comentarios
Thorsten
Thorsten el 16 de Nov. de 2015
Editada: Thorsten el 16 de Nov. de 2015
This traditional convention is not recommended, as far as I understand from https://en.wikipedia.org/wiki/Gigabyte:
In 1998 the International Electrotechnical Commission (IEC) published standards for binary prefixes, requiring that the gigabyte strictly denote 1000^3 bytes and gibibyte denote 1024^3 bytes. By the end of 2007, the IEC Standard had been adopted by the IEEE, EU, and NIST, and in 2009 it was incorporated in the International System of Quantities. Nevertheless, the term gigabyte continues to be widely used with the following two different meanings: [namely 1000^3 and 1024^3]
Guillaume
Guillaume el 16 de Nov. de 2015
Yes, the notation is not recommended. It is however the one used by the memory manufacturers and the one used by Windows to report the amount of memory your computer has.

Iniciar sesión para comentar.


Guillaume
Guillaume el 16 de Nov. de 2015
Editada: Guillaume el 16 de Nov. de 2015
zeros(60000) is the same as
zeros(60000, 60000)
A 60,000 x 60,000 matrix of doubles requires approximately 27 GB of memory.
If you just want a vector of 60,000 elements:
zeros(1, 60000)
  2 comentarios
Stefan Raab
Stefan Raab el 16 de Nov. de 2015
Hey,
if you use the command
memory
you can see the Maximum possible array size. In my case:
Maximum possible array: 17896 MB (1.877e+10 bytes)
A double variable needs 64 bit or 8 byte of memory, so I can save 1.877e+10 bytes / 8 bytes = 2.3463e+09 double variables in one array. The resulting size for a quadratic matrix is then sqrt(2.3463e+09) = 48438. Therefore is a quadratic matrix with size 60000 too big.
Note: If there are many zeros in your matrix, I think you should have a look at sparse matrices: http://www.mathworks.com/help/matlab/ref/sparse.html
Kind regards, Stefan
Walter Roberson
Walter Roberson el 16 de Nov. de 2015
Note: the command memory() is only available on MS Windows systems.

Iniciar sesión para comentar.

Categorías

Más información sobre Function Creation en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by