Matlab doesn't seem to be using all the memory available to it and gives out of memory error.

4 visualizaciones (últimos 30 días)
I am running my code, and it seems to be needing more and more memory, I check the windows memory and it stays the same giving matlab 1 Gb instead of the 6 or 24 that is availible to it. I have been trying sparce I have "clearvars -global" and "clear all" at the beginning of my code I have reassignment to "=[]" and sparse, but Matlab doesn't use or direct me to where or why it can't use the the 32 it has detected of system memory but gives up when it knows it is using 2 Gb according to the memory command.
Error Message:
Out of memory. Type "help memory" for your options.
Error in dembedding_v8 (line 165)
fd_square_inv_alligned = s_param_inv_alligned .* y;
>> whos
Name Size Bytes Class Attributes
x1 1x1 8 double
x2 1x1 8 double
x3 1x1 8 double
x4 1x1 8 double
x5 1x88 176 char
x6 1x90 180 char
x7 1x87 174 char
x8 1x50000 400000 double
x9 1x1 8 double
x10 1x1 8 double
x11 1x1 8 double
x12 1x1 8 double
x13 1x1 8 double
x14 100084x1 800672 double
x15 50000x1 800000 double complex
x16 50000x1 800000 double complex
x17 1x100000 800000 double
x18 1x1 8 double
x19 1x1 8 double
x20 1x100000 800000 double
y21 1x100000 1600000 double complex
note: summing the bytes in whos I get 6001290B or 6MB? which doesn't seem right
>> memory
Maximum possible array: 24202 MB (2.538e+10 bytes) *
Memory available for all arrays: 24202 MB (2.538e+10 bytes) *
Memory used by MATLAB: 2156 MB (2.261e+09 bytes)
Physical Memory (RAM): 32768 MB (3.436e+10 bytes)
* Limited by System Memory (physical + swap file) available.
Edit: Thank you all for your help and insite with the .* failure(doing a matrix square instead of a 1 by x vector resutl I was getting a x by x size matrix) I am able to do 100,000,000 elements for accuracy and add a 1 million for loop all excecuting. Thank you all for your help and comments.
  12 comentarios
Jonathan Fernow
Jonathan Fernow el 24 de Jun. de 2019
I ran the size command with my current run and it looks like it is a 1:1, it looks like the .* created a crazy square matrix when attempting that step.
%code executed
parfor i = 1:length(y1)
z1(i) = x1(i) * y1(i);
end
size(y1)
ans = 1 100000000
>> size(x1)
ans = 100000000 1
>> size(z1)
ans = 1 100000000
>>
Walter Roberson
Walter Roberson el 24 de Jun. de 2019
Your x1 is a column vector. Your y1 is row vector. Since R2016b your code has been the same as if you had written bsxfun(@times, x1, y1) which is like
repmat(x1, 1, length(y1)) .* repmat(y1, length(x1), 1)
producing a rectangular result.
You need x1.'.* y1

Iniciar sesión para comentar.

Respuesta aceptada

Fikret Dogru
Fikret Dogru el 22 de Jun. de 2019
Hello,
You can change your variables to single(variables) so it reduces the memory half and in the preferences increase java space to the maximum.
  4 comentarios
Jonathan Fernow
Jonathan Fernow el 24 de Jun. de 2019
Rik was right as I had a larger issue, but thanks Fikret Dogru singles was a good suggestion, but some of my functions seem to be struggling with the singles implamentation. Singles ran into an issue when convrting the table to double was successful but the table to single seems fine.
Error using single
Conversion to single from string is not possible.
Error in myprogram (line 45)
column7 = single(mytable_element{:,7});
%had/have no problem
column7 = double(mytable_element{:,7});
Walter Roberson
Walter Roberson el 26 de Jun. de 2019
This would probably be irrelevant if you were not using .* between a row vector and a column vector.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Performance and Memory en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by